本文共 710 字,大约阅读时间需要 2 分钟。
public class someList
{
public string strOne { get; set;}
public string strTwo { get; set;}
}
public class Entity
{
public string EntityMember;
public ListentityList;
}
public ActionResult MyControllerAction(Entity objEntity)
$.ajax({
url: "/MyController/MyControllerAction",
type: "POST",
data: JSON.stringify(Entity),
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (data) {
....
}
});
data: JSON.stringify(Entity)//Jquery 默认会转Json obj成键值对,所以必须传送String
var Entity = {};//需要跟mapping的类名或action的参数名一致