How to prevent a jQuery Ajax request from caching in Internet Explorer?
You can disable caching globally using $.ajaxSetup()
, for example:
$.ajaxSetup({ 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...});
If you set unique parameters, then the cache does not work, for example:
$.ajax({ url : "my_url", data : { 'uniq_param' : (new Date()).getTime(), //other data }});
Cache-Control: no-cache, no-store
These two header values can be combined to get the required effect on both IE and Firefox