jQuery在IE中缓存AJAX请求,即使缓存:“false”已设置
我有以下代码
$.ajax({type: "GET", url: "/" + filename, dataType: "xml", cache: "false", success: function(xml) { /* Parsing code here */ }});
在Chrome等中,请求不会被缓存,但它们在IE中。 我正确地构建了我的请求吗?
cache
应该是一个布尔值,而不是一个字符串:
$.ajax({type: "GET", url: "/" + filename, dataType: "xml", cache: false, success: function(xml){ /* Parsing code here */ } });
也许是你要返回的xml文件的mimetype? http://www.nerdydork.com/ie-json-caching-bug.html
我博客上的一位评论者建议在json请求中添加一个时间字符串:
我不会相信在.ajaxSetup中将缓存设置为off ….
所以只需在每个json请求的末尾添加一个时间字符串,例如
$ .getJSON(’/ url /’,{data:123,t 🙁 new Date())。getTime()},function(data){// do whatever});