Yesterday I found out that after executing an AJAX call Internet Explorer will cache the results of future repetitive calls if they are the same -- and serve the cache results, not actually repeate the calls.
Let's say the AJAX call is to this this url: (http://www.somehost.com/people.php?age=3). And people.php echos the text "This has been done." and the javascript that receives this text uses the alert() function to pop it up on the screen.
The first time IE runs this javascript the AJAX call will work fine, and a pop up will show saying, "This has been done." The second and subsequent times IE runs this javascript the call will not be made -- people.php will not be run. Instead you will get the cached result, which is the pop up "This has been done."
Firefox doesn't work like this. Firefox works as should, will actually repeatedly make the calls and not cache the results.
What if you want to make multiple AJAX calls that are the same and not be fed cache?
I learned a cool hack from Lonnie Lee Best to solve the problem.
She wrote about it here, which is where I found out how to solve it.
The key is that IE will feed you cache if the url is the same. So you just need to have a different url everytime you make an AJAX call.
This will solve it:
url = "http://www.somehost.com/people.php?age=3" + "&ms=" + new Date().getTime();
Date().getTime(); gives you the number of milliseconds since the first day in 1970. That will ensure that your url is always different. people.php will just ignore ms.