The json file is a lightweight data interaction format. Generally, it is read using the getJSON() method in jquery.
$.getJSON(url,[data],[callback ])
url: loaded page address
data: optional, data sent to the server, in the format of key/value
callback: optional, callback executed after successful loading Function
1. First create a JSON format file userinfo.json to save user information. As follows:
[
{
"name ":"Zhang Guoli",
"sex":"male",
"email":"zhangguoli@123.com"
},
{
"name":"Zhang Tielin" ,
"sex":"male",
"email":"zhangtieli@123.com"
},
{
"name":"Deng Jie",
" sex":"female",
"email":"zhenjie@123.com"
}
]
2. Secondly, create a page to obtain the JSON file User information data and display