接收数据我有一个问题,试图从POST
接收数据,并在列表中再次回归,这对于遗嘱哪些工作如何从POST在asp.net MVC
这是我的代码:
function Person(ID, name, lastname)
{
var person = { ID: ID, name: name, lastname: lastname };
$.ajax({
url: '/Form/save',
type: 'post',
data: person,
contentType: "application/json; charset=utf-8",
dataType: "json"
}).done(function (msg) {
console.log('Person: '+ msg);
}).fail(function (error) {
console.log('ERROR: '+ error.error);
}).always(function() {
});
}
控制器
[HttpPost]
public ActionResult save()
{
// I NEED YOU - get all data here and return
string name = Request["name"].ToString();
return Json(name, JsonRequestBehavior.AllowGet);
}
你试图返回它作为JsonResult?你能调试save ActionResult吗? – Chris
你有什么问题? –