开发者社区 问答 正文

jquery小问题求教 400 请求报错 

在用ajax发送请求时
$.ajax();里哪项选项里 有 服务器 返回的0,1,2,3信息

 beforeSend:function (xhr) { 
  alert(xhr.readyState); 
     if(xhr.readyState<4) alert("查询中"); 
  }, 
  complete:function (xhr, status) { 
  // alert(xhr.readyState); 
  },  

上面只有0,和4

展开
收起
kun坤 2020-05-30 15:07:13 640 分享 版权
1 条回答
写回答
取消 提交回答
  • xhr.responseText
    http://api.jquery.com/jQuery.ajax/#jqXHR ######complete:function (xhr, status) { // alert(xhr.readyState); console.dir(xhr); } 然后在Chrome控制台下看看输出的xhr到底是什么,你就一目了然了。######什么意思,没看懂?######beforeSend:function (xhr) { $('#result').html("查询中,请稍后"); }, 就是吧

    2020-05-30 15:07:19
    赞同 展开评论