2

I have an ajax request like this:

$.ajax({
        url: "/Controller/DoSomething/",
        data: { status:status
        },
        type: "post",
        dataType: "json",
        success: function (XMLHttpRequest ) {
        },
        error: function(XMLHttpRequest, textStatus, errorThrown){

        }
});

when the server goes down, I get this error on chrome's console:

POST http://localhost:#####/Controller/DoSomething/ net::ERR_CONNECTION_REFUSED

Debugging the XMLHttpRequest object I found a member statusText: "error"

the second parameter "textStatus": has the value "error"

the third parameter "errorThrown": has an empty value

the responseText member is also empty

But I would like to get the console's error message, is there a way, or another member that has a detailed message?

Raphael Ribeiro
  • 529
  • 5
  • 18
  • I would guess that the actual HTTP error is a property somewhere on the jqXHR object that is passed as the first argument to the error callback, but you'd probably have to inspect that object in the console or debugger to find it. – jfriend00 Jan 28 '15 at 17:33
  • see this post:http://stackoverflow.com/questions/1637019/how-to-get-the-jquery-ajax-error-response-text – Suchit kumar Jan 28 '15 at 17:35
  • I am also interested in this, did you ever find a solution? I am worried there is none... – Josh Aug 09 '17 at 20:40

0 Answers0