posts - 431,  comments - 344,  trackbacks - 0

ajax请求同一个url地址时,如果发现url地址没有变而缓存里有就会直接去取值,不会再去请求服务器。这种情况会在不同的机器不同的IE上各有不同,解决的方式是在ajax请求的地址里加上一个随机的参数例如(jQuery):

$.getJSON(path+"/library/structuresView.do?num=1&structCount="+customColumnNum*rowNum+"&datetime="+(new Date()).getTime(), "", function(json){alert(json)}) $.ajax({url: path+"/library/structuresPropertyPreview.do?fetch=all&random="+Math.random(), type: 'GET', success: function(data){alert(data)} });

只要ajax每次请求的地址不一样就可以的。

原文地址:http://yaofeng911.javaeye.com/blog/379705
posted on 2009-06-03 10:33 周锐 阅读(421) 评论(0)  编辑  收藏 所属分类: Ajax

只有注册用户登录后才能发表评论。


网站导航: