Im setting up my ajaxError handler, but when there is an issue with my script (forgot to terminate a line with ; for example) the ajaxError fires, but is it possible it could return the raw html from the webpage so I can see where the error is?

I think its cause Im requesting JSON as the type in my ajaxSetup which is why its not responding with the HTML, so is there anyway I can override it and display the html from the ajax request as HTML instead of JSON?

Thank you in advance
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It sounds like you are trying to see the response of the ajax request. You should use the developer tools of your browser for that.

On chrome, hit F12 to show developer tools; click "Network"; click "XHR". Now initiate the ajax call that caused the error. You should see it appear on the screen.
Chris StanyonWebDevCommented:
There are 2 types of error you need to be concerned with here. An AJAX error and a Server script error. The AJAX error handler will only fire if the actual AJAX call fails (such as 501 / 404 / timeout etc). The AJAX error handler won't fire if there is an error in your server script, because the actual AJAX call succeeded. This is often the cause of confusion because the AJAX success handler will fire, even when your server script errors.

You won't get raw HTML output in an AJAX error handler, because by definition the AJAX call couldn't be made, so there won't be any HTML output to display.

As @mankowitz has pointed out, you can view the raw response from your server call by viewing the console in one of the developer tools, but obviously you can't do that within your script - thats for your eyes only.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.