I spent a couple hours this morning trying to figure out why Internet Explorer was return the same result from an AJAX request which returns a random record from a database.

Because there were no parameters in the querystring, IE chose to cache the request, assuming that it must return the same result, since the parameters are always the same (there aren't any).

If you find yourself in this situation, adding a unique "dummy" value to the querystring should resolve the issue.

Example AJAX request via jQuery:

var d = new Date();
$.ajax({url: 'ajax_random_record?nocache=' + d.getTime(),

Leave a Reply

Your email address will not be published. Required fields are marked *