WebAPI Post请求多参数处理方案

contentType:"application/json"
You need to use JSON.stringify method to convert it to JSON format when you send it,

And the model binding will bind the json data to your class object.

The below code will work fine (tested)

$(function () {
var customer = {contact_name :"Scott",company_name:"HP"};
$.ajax({
type: "POST",
data :JSON.stringify(customer),
url: "api/Customer",
contentType: "application/json"
});
});

posted @ 2016-09-12 13:50  小羽信息  阅读(1341)  评论(0编辑  收藏  举报