如何防止在Internet Explorer中缓存jQuery Ajax请求?
问题描述:
如何在Internet Explorer中阻止jQuery Ajax请求缓存?
How do I prevent a jQuery Ajax request from caching in Internet Explorer?
答
您可以使用 $。ajaxSetup()
,例如:
You can disable caching globally using $.ajaxSetup()
, for example:
$.ajaxSetup({ cache: false });
这会在发出请求时为查询字符串添加时间戳。为特定的 $。ajax()
关闭缓存> 在本地调用,设置 cache:false
,如下所示:
This appends a timestamp to the querystring when making the request. To turn cache off for a particular $.ajax()
call, set cache: false
on it locally, like this:
$.ajax({
cache: false,
//other options...
});