Another solution, which is more of a global solution, is to set up all AJAX requests by default to
contain the no-cache logic we just discussed. To do this, use the ajaxSetup function to globally
switch off caching.
$.ajaxSetup({
cache: false // True by default. False means caching is off.
});
Now, in order to overwrite this global setting with individual XHR requests, you simply change
the cache option when using the ajax() function. Below is a coded example of doing an XHR
request using the ajax() function, which will overwrite the global setting and cache the request.
$.ajaxSetup ({
});
cache: false // True by default. False means caching is off.
jQuery.ajax({ cache: true, url: 'some', type: 'POST' } );
101