Not even sure if this is the right way to title the question. I know I\'m making my AJAX calls all wrong... here\'s what I\'m doing right now (I\'m using ASP.NET MVC backend
I've blogged about this same situation. Maybe it will help you in your situation as well. It's basically about having a custom exception class and an exception action attribute that will return the error. So you're able to use the success
and error
options of the $.ajax
call. Which is in my opinion the right way of doing it.
$.ajax
call does provide functionality to handle success as well as error responses. No need to always return a success with an error flag set that you have to check on the client.