Currently if I have an error with an ajax request such as submitting a form (I\'m using ASP.NET MVC 3) it will show something like \'Internal Server Error\'.
But if I do
This code will replace the current page's contents with the error that came back from the ajax request.
jQuery(document).ajaxError(function (event, request, settings) {
if (request.status === 500) {
$(document.body).html(request.responseText);
} else if (request.status === 401) {
// redirect to login, 401 means session is expired.
window.location.href = "login page url";
}
});