1, the background connection database, take the data
String sql = "..... .... ..."; ... "; ...";. ";"; ";"; ";";
String one = Oraclehelpertools.executescalar (SQL); Here's a oraclehelper.
String flow1 = Jsonconvert.tojson (one); The data is encapsulated with JSON, and the value is formatted to be parsed when it is passed into the foreground
2, in the aspx.cs of the page to write parsing
[WebMethod ()]//ajax must join
public static string Lonpoint () {
string flow = Dalflow.getflow (); Is the above code call
if (flow = = NULL)
{flow = "0"; }
var data = "{\" ng\ ":" + Flow + "}"; Add file headers required for parsing
return data;
}
3, the front desk JS to get the data and analysis
$.ajax ({
Type: "Post",
URL: "Default.aspx/latpoint",//where the above code is placed
Data: "{lat: '" + Lat + "'}",//Incoming values, no, forget it.
ContentType: "Application/json; Charset=utf-8 ",
DataType: "JSON",
Async:false,
Success:function (data1) {
var json = $.parsejson (DATA1.D); JSON parsing
$.each (JSON. NG, function (idx, item) {//ng is the file header just added
Lat.push (item[' LATITUDE '); If it is an array to write, if not then direct x= (item[' field name ');
});
},
Error:function (Err) {
}
});