Json file is a lightweight data interaction format. GetJSON () is generally used in jquery to read data. $. GetJSON (url, [data], [callback]) url: loaded page address data: optional, data sent to the server, format: key/valuecallback: optional, load it... S
Json file is a lightweight data interaction format. GetJSON () is generally used in jquery to read data.
$. GetJSON (url, [data], [callback])
Url: the address of the loaded page.
Data: Optional. data sent to the server. The format is key/value.
Callback: Optional. callback Function executed after successful Loading
1. Create a JSON Format File userinfo. json to save user information. As follows:
[Html]
[
{
"Name": "Zhang Guoli ",
"Sex": "male ",
"Email": "zhangguoli@123.com"
},
{
"Name": "Zhang tielin ",
"Sex": "male ",
"Email": "zhangtieli@123.com"
},
{
"Name": "Deng Yi ",
"Sex": "female ",
"Email": "zhenjie@123.com"
}
]
[
{
"Name": "Zhang Guoli ",
"Sex": "male ",
"Email": "zhangguoli@123.com"
},
{
"Name": "Zhang tielin ",
"Sex": "male ",
"Email": "zhangtieli@123.com"
},
{
"Name": "Deng Yi ",
"Sex": "female ",
"Email": "zhenjie@123.com"
}
]
2. Create a page to obtain the user information data in the JSON file and display
[Html]
GetJSON