Hi there,
I’m trying to loop through this here:
var data = {"test":"yes","people":[{"name":"Chris","age":27,"msg":"Hello"},{"name":"John","age":76,"msg":"Some Text"}],"computers":6,"remember":true}
I Know how to output “Test: yes” and even how to output “Name: Chris” using
alert("Name: " + data.people[0].name);
But every time I try and loop through “data.people.name” or whatever code I use, it never seems to work?
Basically I want it to output this as HTML like so:
Chris
John
Obviously there will be more than 2, so I need the code to produce the divs too.
How would I do that either with jQuery or Javascript? I know it’s probably very simple, but it’s confusing me so much…
Thanks for the help.