asp.net MVC 4从与Ajax调用提交 [英] asp.net MVC 4 submit from with ajax call
本文介绍了asp.net MVC 4从与Ajax调用提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的控制器:
[HttpPost]
public ActionResult Create(Student student)
{ //somecode..
和我想从提交此:
<form method="post" action="/student/create">
<!-- the from contents-->
如何使用Ajax调用提交此 我需要JQuery的AJAX调用,让此表单提交的。
how to submit this from using Ajax call i need the JQuery ajax call that lets this form submitted.
和我要确保有关数据类型, 谢谢
and i want to make sure about datatype , thanks
推荐答案
试试这个
var form = $('#formId');
$.ajax({
cache: false,
async: true,
type: "POST",
url: form.attr('action'),
data: form.serialize(),
success: function (data) {
alert(data);
}
});
这篇关于asp.net MVC 4从与Ajax调用提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文