ajax获取后端序列化返回状态码等参数

 1 <script>
 2     $.ajax({
 3         type: "POST",
 4         url: url,
 5         success: function (response,status,xhr) {
 6             //服务器返回的信息,status和xhr为内置,response为后台返回数据
 7             console.log(response);    
 8             //状态码
 9             console.log(status);    
10             //状态码
11             console.log(xhr.status);    
12             //响应头部
13             console.log(xhr.getAllResponseHeaders()); 
14         },
15         error: function () {
16             console.log("请求失败");
17         }
18     });
19 </script>

 

posted @ 2020-08-21 16:34  zjyss  阅读(984)  评论(0编辑  收藏  举报