jquery - Applying loop to a data retrieved as json -


i've data returned in json {"id":["update1","update2"]} called using jquery ajax().

i want display values in list , that, want determine number of time loop should go; like

while (count < number of data under id) {   $('#test').append(data.id[count]);   count++ } 

so here, how determine number of times loop should take place?

i tried using hasproperty not sure object should apply it!!

try this:

$.each(data.id, function(index, value) {     $('#test').append(value) }) 

or, indeed:

$(data.id).appendto('#test') 

of course, answer original question:

console.log(data.id.length); 

Comments