I have the following code:
$.ajax({
type: "POST",
url: '<%=Url.Action("test","pepole") %>',
data: $("#PeopleForm").submit(),
contentType: "application/json; charset=utf-8",
dataType: "html",
sucess: function() {
},
error: function(request, status, error) {
$("#NotSelectedList").html("Error: " & request.responseText);
}
});
The PeopleForm is displayed in a dialog. After the submit, the dialog gets closed. Is that normal? I don`t开发者_如何学运维 want the dialog to get closed after the submit. How can I do that?
The controller is as below:
public ActionResult test(Model model)
{
model.SaveNotification();
return RedirectToAction("Index");
}
public ActionResult test(Model model)
{
model.SaveNotification();
return Json(new { Result = true });
}
Submit submits a form, browser to leave the current page and go to wherever the action of the form says to go.
The dialog doesn't "close", a new page loads.
You probably want serialize, not submit.
精彩评论