Phi*_* Br 2 javascript ajax internet-explorer
我在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响应,即使服务器上的页面已更改,我也得到了相同的结果。
有没有办法禁用缓存?
在网址中添加一个随机参数,例如时间戳记:
var url="//yoururl.com/";
url+="?"+new Date().getTime();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2715 次 |
| 最近记录: |