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