Home >Web Front-end >JS Tutorial >Detailed analysis of Jquery getJSON method_jquery
Preparation
·Customer class
context.Response.Write(strJson);
Method definition: jQuery.getJSON( url, data, callback )
Get json data through get request
·url is used to provide the address page of json data
·data(Optional) is used to transmit the key-value pair to the server
·callback (Optional) callback function, the processing function after the json data request is successful
So when accessing, use data.Property to access, and use k/v loop to print the record of Song Jiang:
Ashx file (Json_1.ashx) modification:
The string of the json object it generates is:
[{"Unid":1,"CustomerName":"Song Jiang","Memo":"Tiankuixing","Other":"Herosaburo"},
{"Unid":2,"CustomerName ":"Wu Yong","Memo":"Tianjixing","Other":"Zhiduoxing"}]
Here you can see that the json object as a collection is not one record, but 2 records. It is an array of [[object, object]]: [object, object] [object, object], and each [ object, object] represents a record, corresponding to a Customer, which is actually in the form of k/v, and this v is a Customer object, and this k is the index starting from 0.
Methods of list json objects: