JSON file:
[{"Name": "Haha ·", "email": "email 01", "gender": "male", "holobby": ["surfing the Internet ", "playing"] },{ "name": "Haha ·", "email": "email 02", "gender": "male", "holobby ": ["online shopping", "playing"]}]
JSCode:
<SCRIPT type = "text/JavaScript"> $ (document ). ready (function () {$. ajax ({// Request Method: GetType: "Get", // URL of the JSON File Location: "user. JSON ", // The returned data format is jsondatatype:" JSON ", // method to be executed after the request is successfully completed success: function (data) {// use $. the each method traverses the returned data date and inserts it into ID # result $. each (data, function (I, item) {var content = item. name + "," + item. email + "," + item. gender + "," + item. holobby [0] + "," + item. holobby [1] + "</BR>"; $ ("# result "). append (content) ;}}})}); </SCRIPT>