I have a view with a compilation error. This view gets loaded via an ajax call. I would like to return the compilation error message as a simple string message, but MVC is returning an entire HTML page as an error.
I have an ajax error handler that looks for the error message in request.responseText, like this:
$(document).ajaxError(function (event, request, settings) {
....
//contains html error page, but I need a simple error message
request.responseText
....
});
How can I return a simple error message to the ajax error handler when there is a view compilation error?