我使用此函数通过ajax显示项目页面。它在Chrome.but上工作得很好,而不是在internet explorer上。
<script type="text/javascript">
function grabInfo(str)
{
if (str=="")
{
document.getElementById("contentDiv").innerHTML="";
return;
}
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)
{
document.getElementById("contentDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","get_property.php?q="+str,true);
xmlhttp.send();
}
</script>此函数在Internet Explorer中返回Chrome.But上的更新结果,此函数使用Ctrl+Shift+Del返回以前的results.If I清除会话,系统显示更新的results.why是否会发生这种情况?你能帮个忙吗?
提前感谢....
发布于 2013-05-14 14:44:38
Internet Explorer缓存响应。您可以使用Math.random()向请求URL的查询字符串添加一个随机值,也可以在服务器端脚本中包含一个响应头。
Cache-Control: no-cache, no-store发布于 2013-05-14 14:45:09
问题是IE缓存了请求,只要查询字符串没有改变,它就会返回相同的响应,这可以由服务器端的头来处理。
Cache-Control: no-cache, no-store但最简单的方法是像这样修改请求:
xmlhttp.open("GET","get_property.php?q="+str+"&r="+Math.random(),true);https://stackoverflow.com/questions/16536639
复制相似问题