jQuery AJAX Cache Problem on Internet Explorer

Internet Explorer (IE) caches the AJAX request. So if I make ajax queries with same URL(with the exact same parameters), it tends to give me same result/output as IE caches the data that it gets from first query.

No other browser, by default, caches AJAX requests… but IE does.

What we have to do is tell, right on the request, that we don’t want the result to be cached. So on a jQuery AJAX request, we would do:

cache: false,
url: 'http://myurl',
data: {}

This will work for this particular request. If you want to expand the scope of this setting to all AJAX requests, you can set it on the global AJAX configuration:

$.ajaxSetup({ cache: false });

About kaanmutlu

Software Developer - Computer Engineer from Istanbul, Turkey
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s