搜索到的解决办法:
1、在服务端加 header("Cache-Control: no-cache, must-revalidate");
2、在ajax发送请求前加上 xmlHttp.setRequestHeader("If-Modified-Since","0");
3、在ajax发送请求前加上 xmlHttp.setRequestHeader("Cache-Control","no-cache");
对于2和3也就是这样实现:
function changepass(upass) {
createXMLHttpRequest();
var url = "cpass.asp?uid=" + upass ;
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = callback;
xmlHttp.setRequestHeader("If-Modified-Since","0");//清楚ie缓存------>2
//xmlHttp.setRequestHeader("Cache-Control","no-cache");//清楚ie缓存------->3
xmlHttp.send(null);
}
4、在 Ajax 的 URL 参数后加上 "?fresh=" + Math.random(); //当然这里参数 fresh 可以任意取了
5、第五种方法和第四种类似,在 URL 参数后加上 "?timestamp=" + new Date().getTime();
6、用POST替代GET:不推荐
来源:csdn