JQuery以JSON方式提交数据到服务端

第一步:把对象转JSON字符格式javascript

var jsonStringify = JSON.stringify({})

 第二步:POST提交java

$.post("/api/notify_url.aspx", jsonStringify, function (res) {

}, "json");

 第三步:.NET后台接收数据json

protected void Page_Load(object sender, EventArgs e)
{
    Response.ContentType = "application/x-www-form-urlencoded";
    StreamReader reader = new StreamReader(Request.InputStream);
    string stream = reader.ReadToEnd();
    notifyjson json = new JavaScriptSerializer().Deserialize<notifyjson>(stream);
}
相关文章
相关标签/搜索