Marco2752

导航

 

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();

 

posted on 2019-12-30 17:10  Marco2752  阅读(945)  评论(0编辑  收藏  举报