I've got a JSON string that takes this form...
{
"people": [
{
"name": "person1",
"description": "This is a brief description of my service.",
"image": "mandg1.jpg",
"type": "first",
"insured": "yes",
"license": "N\/A",
"picture": "mandg1.jpg",
"yearsinbusiness": "8",
"distance": 15
},
{
"name": "person2",
"description": "This is a brief description of my service.",
"image": "mandg2.jpg",
"type": "second",
"insured": "yes",
"license": "N\/A",
"picture": "mandg2.jpg",
"yearsinbusiness": "8",
"distance": 19
}
]
}
What I'd like to do is, via jQuery, build a group of divs based upon the "people" key...so in the instance above...you'd end up creating 2 elements...and append them to the div id="container". If there were 50 elements, you'd end up with 50 divs, etc etc etc.
<div id="container">
<div id="person1">
<p>Name: person1</p>
<p>Description: This is a brief description of my service</p>
</div>
<div id="person2">
<p>Name: person2</p>
<p>Description: This is a brief description of my service</p>
</div>
</div>
What would the jQuery syntax for that be? Thanks in advance!