asp.net mvc - How do I get the exception message from a failed jQuery request? -


If I use jQuery AJAX with an error handler and ASP.NET MVC action, then I throws an exception I want to be able to display messages in the exception of the user I am currently using:

<.> $ .ajax ({... error: work (request, condition, error) {Var exp = new RegExp ('title & gt; (. *) & Lt; \ / title & gt;', 'i'); if (exp.exec (request.responseText)) {Warning (RegExp .lastParen);} and {warning (status);}}});

I'm hoping for a canonical jQuery implementation instead of my own rolling.

What matters for this, I usually have an action which is an attempt by a JasonResult / Cache rolls into blocks so that it can not throw an exception. Instead, I return two parameters with every JSON array: "OK" (true / false) and "message" (if there is an error then there is a message to show the user).

Then I do a simple branch on the $ .ajax "error" parameter, and the "OK" parameter of the JsonResult result.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -