标签:
1.前台代码
/* * 跨域请求Post * 1个对象参数,后台JObject接受 */ $.post(apiUrl.getOne("PostFourth"), { name: ‘张三‘, age: 12 }, function (data) { alert(data); }); $.ajax({ url: apiUrl.getOne("PostFourth"), data: { name: ‘张三‘, age: 12 }, type: ‘post‘, success: function (data) { console.info(data); alert(data); } });
2.后台代码
//Post请求 1个或多个对象参数 public string PostFourth([FromBody]Newtonsoft.Json.Linq.JObject data) { //return data.ToString(); dynamic result = data; return result.name; }
Asp.Net WebAPI传递json对象、后台手动接收参数
标签:
原文地址:http://www.cnblogs.com/tianma3798/p/5089847.html