如何prevent缓存从jQuery的阿贾克斯? [英] How to prevent caching from jQuery Ajax?
问题描述
任何人都可以请帮我这个?我在使用了名为.manifest离线存储缓存的网页。在该页面中,我使用jQuery的Ajax调用从服务器获取数据。如果我第一次加载页面时,它是确定。我可以在线和离线之间进行切换。但问题是,当我回去上网,并刷新页面。 jQuery的AJAX能不能谈谈服务器了。有没有办法来为Ajax去跟服务器或清除脱机缓存?
我的Ajax调用是这样:
$。阿贾克斯({
键入:GET,
网址:requestUrl,
成功:localSuccess,
错误:错误,
数据类型:文本,
缓存:假的
});
我有这块code在每一页/ Master页面的顶部
在IE //禁用缓存,监守它的邪恶!
$(文件)。就绪(函数(){
$ .ajaxSetup({缓存:假});
});
Could anyone please help me with this? I have a web page using .manifest for offline storage caching. In that page, I use jQuery ajax call to get the data from the server. If I first load the page, it is OK. I can switch between Online and Offline. But the problem is when I go back online and refresh the page. jQuery ajax cannot be able to talk to server anymore. Is there a way to for ajax to talk to the server or clear offline cache?
My ajax call is as such:
$.ajax({
type: "GET",
url: requestUrl,
success: localSuccess,
error: error,
dataType: "text",
cache:false
});
I have this piece of code at the top of each page/Master page
//Disable caching in IE, becuase it's EVIL!
$(document).ready(function () {
$.ajaxSetup({ cache: false });
});
这篇关于如何prevent缓存从jQuery的阿贾克斯?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!