Last Updated: January 28, 2019
·
2.589K
· macsdickinson

Open AJAX error response in a new window

Ever get annoyed when inspecting errors returned from your failed AJAX calls? I do. This following function will open up the response in a new window.

function popUpError(err) {
    var output = err.responseText;
    var openWindow = window.open("errorDetails.html", "mywin", '');
    openWindow.dataFromParent = output;
    openWindow.init();
}

Probably not one to leave in when your code goes to production but it can speed things up a little during the development process.

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside