This link: https://blog.csdn.net/qq_22103321/article/details/78015920
Front-end data submitted json
.ajax $ ({
type: "POST",
URL: URL, // request address
data: JSON.stringify (data), // json data, such as { "key1": "value1" , "key2": "value2" }
dataType: "JSON",
beforeSend: function (the XMLHttpRequest) {
// service request before
},
success: function (Data, textStatus) {
// successful service request
},
error: function (the XMLHttpRequest, textStatus, errorThrown) {
// service request error
}
});
the server parsing json
introduced class
using System.IO;
using System.Web.Script.Serialization;
context.Response.ContentType = "application/json";
var data = context.Request;
var sr = new StreamReader(data.InputStream);
var stream = sr.ReadToEnd();
var javaScriptSerializer = new JavaScriptSerializer();
var jarr = javaScriptSerializer.Deserialize<Dictionary<string, object>>(stream);
string sValue = "";
foreach (var j in jarr)
{
sValue += j.Value.ToString() + ",";
----------------
Disclaimer: This article is the original article CSDN bloggers' Mick_ Ma Ying-jeou, "the follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/qq_22103321/article/details/78015920