监听接口请求的报错403或者401等

一、代码
接口请求有的时候需要监听报错状态提示信息内容

error: function(res) {
    
    
     var jsonResponse = JSON.parse(res.responseText);
     if(jsonResponse.status == 401) {
    
    
               alert(jsonResponse.message);
     }
  }

猜你喜欢

转载自blog.csdn.net/huang_jimei/article/details/108624191
今日推荐