ajax用post模拟提交表单请求&&后台获取数据方法
时间:2019-12-30 18:07:11
收藏:0
阅读:494
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();
原文:https://www.cnblogs.com/marco2752/p/12120732.html
评论(0)