How do you trigger the “error” callback in a jQuery AJAX call using ASP.NET MVC?

后端 未结 6 1490
心在旅途
心在旅途 2020-12-12 21:04

This is related to my question on how to handle errors from jQuery AJAX calls. Several responses suggested that I use the \"error\" callback to display any errors from a jQ

6条回答
  •  粉色の甜心
    2020-12-12 21:45

    I think that event is raised for any response that has a response code other than 200. I can't find proof of this in the docs though.

    To do this from code (works in Webforms):

    throw new HttpException(500, "Error message");
    

提交回复
热议问题