The exception handling of ajax in project development is a headache, because it is an asynchronous request, so even if the ajax exception program continues to execute, it is more troublesome to find ajax exceptions.
Today, I found an article when dealing with ajax exceptions, which mentioned that error can return ajax exception information.
$.ajax({ url: url, type: "post", date: date, dataType: "json", success: function(){ //callback; } error: function (XMLHttpRequest, textStatus, errorThrown) { // status code console.log(XMLHttpRequest.status); // condition console.log(XMLHttpRequest.readyState); // error message console.log(textStatus); } });