I was making an Ajax request to a Java Servlet using a URL like http://servername.com/servletname
The servlet needed a value that I can't pass to it as a url parameter because the server was blocking query strings in URL's like http://servername.com/servletname?parameter=value
so I used cookies to pass the value to the servlet. I set the cookie with JS and the Servlet read the cookie, with different values of this cookie the servlet returned a different response.
The problem was that IE was only getting the information of the first request, subsequent requests only get the same info as the first request no matter if the cookie value was different. This was because the URL I was using http://servername.com/servletname
was always the same (since I didn't need parameters in the URL) so for IE it was the same request and instead of request the info to the servlet again it used the cache of the previous request.
To resolve this I added a dummy query string of the URL, I still used cookies to pass the value but I added a url parameter to make the url different every time. So I added this to the JS code:
servletURL = 'http://servername.com/servletname?param' + Math.random() * Math.random();
This was creating a different URL in every request so IE requested every time instead of using cache.