If I have an ASP.NET MVC controller action that is called from a jQuery .ajax call that needs to throw an error, how do I do so? I know I can create a JSON object and pass it an ‘error’ property, but what if the response from the .ajax call isn’t expected to be JSON but HTML instead?
Share
Use the HandleError attribute, and set View to a view which returns the appropriate HTML fragment.