【发布时间】:2012-03-27 05:07:49
【问题描述】:
有两个选项很突出。 OnSuccess 和 OnFailure。如果页面更新成功或失败,这些允许我调用函数。所以,我有一个被称为发送和电子邮件的操作,并且有这个代码......
try
{
// Code to send email
return Content("Your message has been successfully!", "text/html");
}
catch (Exception ex)
{
return Content("An error occurred sending your message...", "text/html");
}
问题是即使它落入Exception它仍然调用OnSuccess。我想要做的是在它落入异常时调用另一个函数。我该怎么做呢?
【问题讨论】:
标签: jquery ajax asp.net-mvc exception-handling