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
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn