In my current project, I am encountering a problem with AJAX specifically in Internet Explorer 11. The issue arises when the page requests certain values from the server through an AJAX call using the following code snippet:
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function ()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
doSomeThing();
}
}
xmlhttp.open("GET", "theURL", true);
xmlhttp.send();
Interestingly, this code works perfectly in Chrome and Firefox but appears to encounter caching issues in Internet Explorer. It seems like IE is storing the AJAX response in its cache, leading to the same result being returned even after changes have been made on the server.
Is there a way to disable this caching behavior in Internet Explorer?