type: 'Post',
url: "/Home/exp",
dataType: 'json',
data: a,//json
contentType: "application/json;charset=utf-8",
success: function (data) {
console.log(data.Message);
},
error: function (e) {
alert("发送失败");
}
});
``` public JsonResult exp(JsonResult code) {
object d = new { Message = code };
return Json(d, JsonRequestBehavior.AllowGet);
}
不要用jsonresult,它是用来返回json的
你需要写一个和你json一样结构的类来接收
参考:https://stackoverflow.com/questions/15317856/how-do-you-post-a-json-file-to-an-asp-net-mvc-action/15318612