JS代码
function postForm() { var data = new FormData(); var post_data = { "K1": "Va", "K2": "V2", "K3": "V3"}; data.append("MyParam", JSON.stringify(post_data)); $.ajax({ type: "post", url: "http://localhost:8000/API/MyMethod", contentType: false, cache: false, currentType: false, processData: false, data: data, success: function (res) { alert("success"); }, error: function (xmlHttpRequest, textStatus, errorThrown) { alert("error"); } }); }
WebApi 接收
string jsoninfo = HttpContext.Current.Request["MyParam"].ToString();