AJAX is essentially a method of getting data to a browser without refreshing a page. Web pages normally have to be entirely downloaded to see new data from the server, but with AJAX you can send the request "behind the scenes" and receive the data asynchronously. This is what makes Gmail and similar web applications so great. They're dynamic.
Uh oh, I emphasized dynamic. I must have done that for a reason. If you view the Wikipedia article on AJAX and search for "dynamic," you should find no less than ten instances. That's one of the key reasons for AJAX. Why do I keep repeating this? Because Internet Explorer does not understand that. No, not just IE6, but the "brand new" IE7 too.
Internet Explorer has always had problems with cache. It will often not update images, CSS, etc. without the user manually forcing a refresh (CTRL+R) and is even flakey with that. Why should a user ever have to tell the browser, "Hey, would you mind seeing if this page you are showing me isn't ancient?" IE even has an "automatic" option for cache, which automatically screws up regularly. The more significant problem is that IE actually caches AJAX responses. Why is that significant? Because AJAX is dynamic (unless using IE).
For a simple (not practical) example, let's say you send an AJAX request to a page called "randomNumber.php," which returns a random integer. Firefox, Safari, Opera, etc. will send the AJAX request each time and the responses might be "7," "13," "29," etc. IE sends the request one time and relies on the cached data each time it is called. That results in something like "24," "24," "24," "24," ....not dynamic, and certainly not the correct response.
The funny (in a sadistic web developer kind of way) thing about this is the way I found out. I am developing an application application (i.e., a web application that can submit, modify, etc. job applications) and one of the parts is Placement Preference. There are nine check boxes where the applicant can pick where he or she would prefer to work. The admin side just lists the applicant's selections, but you can hit the edit button. The edit button sends an AJAX request to a PHP page that returns an HTML form with check boxes for the choices. I had them grouped into threes and set as "float:left;" to create three nice columns. IE decided that meant the H2 should magically disappear and sometimes reappear if highlighted by the mouse. I decided, "Fine, I'll just make it one big list of check boxes with no styling for now." I test it in FF and it works (no surprise there). I test it in IE and what happens? It returns three floating divisions just like before. I did a bunch of testing and found that IE6 and IE7 cache the AJAX responses and do not send new requests. They both assume that if the query is the same, the result is the same. Basically, I was troubleshooting one bug/standards failure of IE and found another.
My solution was the create a JavaScript function that I can append to a query, which adds a query variable to force IE to think the request is unique and actually send it.
-
function ieDoesNotHandleAjaxCorrectly()
-
{
-
var date = new Date();
-
var stamp = date.getTime()
-
return "&iesucks=" + stamp;
-
}
Having to do that is about as dumb as displaying a security message when someone clicks View Source on a webpage (link credit: Bernzilla)....


Yet another in a long list of reasons why I am switching permanently to Lynx.