<div id="dlg" class="CreateAblum" title="创建专辑">
//这里更新获得的后台数据以及用JS摄者的txt1的文本
@ViewBag.str;
<input type="text" id="txt1" name="txt1" />
//提交
@using (Ajax.BeginForm("Create", "Picture", null,
new AjaxOptions
{
UpdateTargetId = "dlg",
InsertionMode = InsertionMode.InsertAfter,
LoadingElementId = "",
HttpMethod = "POST",
OnSuccess="AddComplet"
}
))
{
<div>@Html.ValidationMessageFor(m => m.Name)</div>
<div>
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name)
</div>
<div>
@Html.LabelFor(m => m.Type)
@Html.DropDownListFor(m => m.Type, ViewBag.AblumTypes as SelectList)
</div>
<input id="logon" type="submit" value="登录" />
}
</div>
后台是这样的
[HttpPost]
public ActionResult Create()
{
ViewBag.str = "11";
return Content("33");
}
运行后页面却跑到了一个新的页面去了http://192.168.1.100/Picture/Create
期望是在原来的页面Index更新viewbag的显示的。求大侠指教要怎么做才能不跳转到新的页面,只更新原来页面id为dlg的块