首页 新闻 会员 周边

XHR : status 等于0

0
悬赏园豆:10 [已解决问题] 解决于 2018-06-27 18:59
为什么status HTTP状态码会是0?
 
 
 
<body>
  <input id="con_" type="text" value=" " >
  <button id="submit_">submit</button>
 
<script>
  submit_.onclick = function(){
    console.log(1)
    var xhr =new XMLHttpRequest();
    xhr.open('get','datas.js',true);
    xhr.send();
    xhr.onload = function(){
    console.log(2)
    if( xhr.readyState == 4 && xhr.status === 0 ){
      console.log(3)
      // console.log(xhr.response);
    }
 
  }
 
}
 
 
 
</script>
</body>
doios的主页 doios | 初学一级 | 园豆:4
提问于:2018-06-25 23:11
< >
分享
最佳答案
0

网络都不通,列html有什么用

收获园豆:10
花飘水流兮 | 专家六级 |园豆:13560 | 2018-06-25 23:30
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册