当前位置: 代码迷 >> ASP.NET >> javascript中xmlhttp超时,有时取不到数据。解决方案
  详细解决方案

javascript中xmlhttp超时,有时取不到数据。解决方案

热度:8194   发布时间:2013-02-25 00:00:00.0
javascript中xmlhttp超时,有时取不到数据。
xmlhttp.open( "get ",weburl1,true);
  xmlhttp.onreadystatechange=function()
  {                  
      if(xmlhttp.readyState==4)
        {
              var   xmlstr   =   xmlhttp.responseText;        
        }
  }

------解决方案--------------------------------------------------------
是么?

xmlhttp.onreadystatechange=function()
{
alert(xmlhttp.readyState );
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
var xmlstr = xmlhttp.responseText;
alert(xmlstr);
}
}
}

看看弹出什么东东

------解决方案--------------------------------------------------------
xmlhttp.onreadystatechange=function()
{
alert(xmlhttp.readyState );
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
var xmlstr = xmlhttp.responseText;
alert(xmlstr);
}
}
}
//别忘了
xmlhttp.send();
------解决方案--------------------------------------------------------
如果不行就换个传递方式吧
xmlhttp.open( "POST ",weburl1,false);
  相关解决方案