当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Ajax call back function to redirect another page

问题描述:

I need to capture 901 error codes in my header.jsp to handle ajax errors globally.

In browser console I am getting:

GET https://localhost:8443/SSApp/Pan/report?&vessel…namax%20Tanker%20Pool%20Limited&rptTitle=Activity%20Report&_=1431351700771 901 (OK)

How can I capture and redirect on the basis of whether we got 901 error code or not?

网友答案:

you can use the ajax status code:

$.ajax({
  statusCode: {
    400: function() {
      alert('400 status code! user error');
    },
    901: function() {
      alert('error 901');
    }
  }
});
分享给朋友:
您可能感兴趣的文章:
随机阅读: