表单是否在form.submit()之后关闭?

时间:2010-05-18 09:19:38

标签: jquery asp.net-mvc-2

我有以下代码:

$.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);
        }
    });

PeopleForm显示在对话框中。提交后,对话框将关闭。这是正常的吗?我不希望在提交后关闭对话框。我怎么能这样做?

控制器如下:

public ActionResult test(Model model)
    {
        model.SaveNotification();
        return RedirectToAction("Index");
    }

public ActionResult test(Model model)
        {
            model.SaveNotification();
            return  Json(new { Result = true });
        }

1 个答案:

答案 0 :(得分:2)

提交提交表单,浏览器离开当前页面,然后转到表单操作的任何地方。

对话框没有“关闭”,加载新页面。

您可能需要serialize,而不是提交。

相关问题