【发布时间】:2015-06-04 15:58:57
【问题描述】:
假设我将一个表单发布到一个 MVC 控制器和这样的操作
function ajaxFunction() {
$.ajax({
type: "POST",
url: "ControllerName/FirstMethod",
data: $('#form').serialize(),
success: function () {
//I'm wondering if this gets run after the FirstMethod or SecondMethod
}
});
)
控制器动作做了一些事情,然后像这样重定向到下一个方法
[HttpPost]
public ActionResult FirstMethod()
{
//Some code run here
//Send to the next method
return RedirectToAction("SecondMethod");
}
public void SecondMethod()
{
//Something else done here
}
所以整个过程就是先post到FirstMethod,然后运行SecondMethod。我的问题是 - Ajax success() 方法何时运行?是在 FirstMethod 之后还是 SecondMethod 之后?
【问题讨论】:
标签: jquery ajax asp.net-mvc controller