Unexpected Caching of AJAX results in IE8

IE is notorious for its aggressive caching of Ajax responses. As you’re using jQuery, you can set a global option:

$.ajaxSetup({
    cache: false
});

which will cause jQuery to add a random value to the request query string, thereby preventing IE from caching the response.

Note that if you have other Ajax calls going on where you do want caching, this will disable it for those too. In that case, switch to using the $.ajax() method and enable that option explicitly for the necessary requests.

See http://docs.jquery.com/Ajax/jQuery.ajaxSetup for more info.

Leave a Comment