gender: true,
city: “shanghai”
},
{
id: “002”,
name: “lisi”,
age: “21”,
gender: false,
city: “beijing”
}
];
单纯一个数组传递是作为data传递是,Form Data也是无法识别出的。因此把这个数组再次组成一个json形式。如下:其中json的键值用model是为了能和controller中的参数名相同,可以匹配。
var jsonp = { model: persons };
var option = {
url: ‘/test/ReadPersons’,
type: ‘POST’,
data: jsonp,
dataType: ‘html’,
success: function (result) { alert(result); }
};
由于未指定contentType,因此是默认的application/x-www-form-urlencoded。此时是按照Form Data的方式传递的,

可以从截图中看到。但是这种格式的数据,controller中只能获得指定model用2个元素,无法获得元素中属性的值。
![clipboard[1] clipboard[1]](https://www.easck.com/d/file/200523/20200523060118316.jpg)
如果把data改成JSON.stringify(jsonp),如下:
var option = {
url: ‘/test/ReadPersons’,










