Tuesday, April 21, 2015

jquery get json data from json array with for loop

var data = {

"users": [



{
 
"firstName": "Ray",

"lastName": "Villalobos",

"joined": {

"month": "January",

"day": 12,

"year": 2012



}

},

{
 
"firstName": "John",

"lastName": "Jones",

"joined": {

"month": "April",

"day": 28,

"year": 2010



}

}

]

};
 
for (var i in data.users) {

alert(data.users[i].firstName + " " + data.users[i].lastName + " " + data.users[i].joined.month);



}

No comments:

Post a Comment