仍在试图弄清楚,这是我的工作流程:
- 一旦提交被点击,jquery 将发送一个 post 请求来调用该方法
- 方法返回部分视图
<div id = "messageForm">...</div>
局部显示
下面是表单视图:
//SignUp.cshtml:
<div id ="messageForm">
@using (Ajax.BeginForm("SignUp", "MVP", new AjaxOptions
{
Confirm = "Are you sure you want to send this message?",
HttpMethod = "Post",
InsertionMode = InsertionMode.Replace,
LoadingElementId = "loading",
UpdateTargetId = "messageForm"
})) {
@Html.AntiForgeryToken();
@Html.ValidationSummary(true)
<fieldset>
<legend>
messageModel
</legend>
<p>
<input type ="submit" value ="Send Message" />
</p>
</fieldset>
这是控制器:
//MVPController
[HttpPost]
public ActionResult SignUp(MVCView model){
return PartialView("_ThankYou");
}
public ActionResult SignUp(){
return View();
}
这是视图文件夹中的部分视图:
谢谢你.cshtml:
<h1>Thank you so much! We will contact you later</h1>
测试时,我没有看到确认对话框,它重定向到感谢页面
谁能告诉我为什么会这样?