0
我有以下代碼:Form.submit()之後表單是否被關閉?
$.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 });
}
使用序列化,它不會傳遞給控制器! – learning 2010-05-18 09:30:31
它可能會破壞,因爲你聲稱數據是application/json。 – Quentin 2010-05-18 09:41:01
我已經修改了上面編輯過的代碼,我沒有像預期的那樣返回Json。它向我顯示保存json文件的對話框。我已經有Microsoft mvcajax和microsoftajax包括在內。 – learning 2010-05-18 10:45:06