ajax 提交Dictionary

ajax向webapi提交Dictionary

Script:

var data = { "a": 1, "b": 2, "c": "hello", };

        $.ajax({
url: "/api/Test/Post",
type: "post",
contentType: "application/json",
data: JSON.stringify(data),
success: function (m) {
console.log(m);
}
});

Webapi

public class TestController : ApiController
{ // POST api/<controller>
[HttpPost]
public string Post(Dictionary<string,object> dict)
{ return "123";
} }

结果:

ajax 提交Dictionary

上一篇:PostgreSQL学习手册(角色和权限)


下一篇:20172302 《Java软件结构与数据结构》实验三:查找与排序实验报告