Fez Vrasta
Fez Vrasta

Reputation: 14815

PHP Ajax requests are cached by Internet Explorer 9

When I call:

$("#id").load("file.php");

Internet Explorer 9 uses a cached response of file.php instead of take the updated response.

At the moment the only solution I've found is to use:

$("#id").load("file.php?random=" + Math.random() );

But it doesn't looks a nice solution.
How could I do?

Upvotes: 1

Views: 121

Answers (2)

LCJ
LCJ

Reputation: 22652

I have seen this problem in IE8

Similar to what you posted in the question, we used to use the following

url = url +'?rnd=' + Math.random();

However after reading jQuery caches AJAX request in IE even though cache: "false" is set, I am planning to use cache: false

Upvotes: 1

dgierejkiewicz
dgierejkiewicz

Reputation: 103

$.ajaxSetup ({    
  cache: false
});

Should do the job.

Upvotes: 1

Related Questions