【发布时间】:2015-06-08 22:32:43
【问题描述】:
我有一个 Web Api,其中有这段代码
@{
AjaxOptions addAjaxOpts = new AjaxOptions
{
// options will go here
OnSuccess = "getData",
OnFailure="selectView('add')",
HttpMethod = "Post",
Url = "/api/AccountManage/CreateAccount"
};
}
在控制器中:
[HttpPost]
public void CreateAccount(CollaborateurModel item)
{
try{}
catch{
// return failure
}
}
我需要实现failure part来执行OnFailure方法。
那么我该如何完成这个任务呢?
【问题讨论】:
标签: javascript c# ajax razor asp.net-web-api