我在IE 11中遇到AJAX的问题。我的页面正在使用以下代码通过服务器通过AJAX询问正确的值:
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();
Run Code Online (Sandbox Code Playgroud)
在Chrome和Firefox中,它工作正常,但IE似乎缓存了AJAX响应,即使服务器上的页面已更改,我也得到了相同的结果。
有没有办法禁用缓存?