我有这样的控制器:
[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);
}
});