问题描述:

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');
    }
  }
});
相关阅读:
Top