1. Use each to traverse
var tbody = "";
//------------Usage of traversing object .each-------------
//Object syntax JSON data format (when the object data format returned by the server callback is json data format, the format requirements of JSON must be ensured, and the callback object must be converted using the eval function (otherwise, the Object will not be obtained). This article will not go into details Introducing the data issue of server-side callback, we will customize the object directly)
var obj = [{ "name": "Xiang Haijun", "password": "123456"}];
$("#result").html("------------遍历对象 .each的使用-------------");
alert(obj); //It is an object element
//Use each to traverse below
$.each(obj, function (n, value) {
alert(n ' ' value);
var trs = "";
trs = "
$("#project").append(tbody);
});
2. jquery traversal and parsing json object 1:
3. jquery traversal and parsing json object 2
has the following json object: