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?
views:
571answers:
1
+4
A:
Use the HandleError attribute, and set View to a view which returns the appropriate HTML fragment.
[HandleError(View="AjaxErrorFragment")]
public ActionResult ICallThisWithjQuery() {
Craig Stuntz
2008-12-31 14:20:58