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:
[{"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
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">