Is there a way to catch failed to load resource: net::ERR_CONNECTION_REFUSED
, I've tried:
try {
$.post('',{},function(res) {
}).fail(function (xhr, textStatus, errorThrown) {
xhr.textStatus = textStatus;
xhr.errorThrown = errorThrown;
console.log('fail',xhr);
// how to get the 'ERR_CONNECTION_REFUSED' or anything else as string?
});
} catch(e) {
console.log('catch',e);
}
The fail function could catch, but I got no information about the error, either it is:
or anything else.. the question would be, how to get the kind of error?