See actual response instead of "This request has no response data available"

Viewed 6332

When there is something that fires Ajax or XHR Request, sometimes, if the php (or other server side script) has some fatal error, the Chrome browser returns such response:

enter image description here

However, if we manually open that failing url, then the browser shows the output from that page (i.e. Fatal error - $variable not defined or whatever ). How to see that actual response message in chrome, instead of the 500 (Internal Server Error) ?

1 Answers

Not a solution, but if someone needs to get more details about that call, hook a function into AJAX/XHR request (define this in chrome console):

(function() {
    var origOpen = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function() {
        this.addEventListener('load', function() {
            console.log(this);
        });
        origOpen.apply(this, arguments);
    };
})();

After that, when triggering the AJAX action, the console will show the details.

Related