解决ajax应用中的缓存问题很简单.只要在url中增加一个变量就可以了.这样浏览器就会认为你每次访问的都是不同的地址.当然就不存在缓存问题了.
例如:


function SendData(sUrl,Id)
{  
 var xh = createXmlHttpRequestObject();
 xh.open("GET",sUrl+Math.random(),false);
 xh.onreadystatechange=function(){
  if(xh.readyState == 4 && xh.status == 200)
  {
   if (xh.responseText=="fail")
   {
    alert("不能重复投票");
   }
   else
   {
    document.getElementById(Id).innerHTML=xh.responseText;
   }
  }
 };
    xh.send();

}

相关文章:

  • 2021-07-11
  • 2021-09-14
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案