Home  >  Article  >  php教程  >  ajax缓存问题解决途径

ajax缓存问题解决途径

WBOY
WBOYOriginal
2016-06-13 12:35:061051browse

我用PHP和Ajax结合,添加数据之后,刷新前台页面,数据没有变化。
我改动PHP动态脚本,只有重新找开IE再输入地址,才能看到效果。
以上这些是不是缓存的原因啊?怎么解决?
ajax缓存问题解决途径:
是缓存的问题。
在服务端加 header("Cache-Control: no-cache, must-revalidate");
并且在你的JS提交参数中加随机或是时间字符串
url+"?timeStamp="+new Date().getTime();

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn