当前位置: 移动技术网 > IT编程>脚本编程>Ajax > Ajax中要注意的问题

Ajax中要注意的问题

2017年12月12日  | 移动技术网IT编程  | 我要评论
ajax调用的返回数据会被缓存,调用静态html ,即使把html修改了,ie依有可能然用原来的数据显示。 而firefox可以正常显示新的数据。 

解决办法:

prototype的get中,设置

pars = "mod=readarticle&fid='+$f('fid')+'&rand='+math.random();
使用java提供的方法设置http头信息,在jsp或者servlet中都可以 
response.setheader("pragma","no-cache"); 
response.setheader("cache-control","no-cache"); 
response.setdateheader("expires", 0); 
使用html标记,如下: 
<head> 
<meta http-equiv="pragma" content="no-cache"> 
<meta http-equiv="cache-control" content="no-cache"> 
<meta http-equiv="expires" content="0"> 
</head>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网