With $.ajax
, I'm getting a JSON response like follows:
[{"project":{"name":"P1111", description":"I like chicken soup","active":true}} .....repeats several times]
What I'd like to do with jQuery is take that JSON response, and loop through it to create the following on id=target
<ul id="target">
<li>P1111 - I like chicken soup - active</li>
<li>3311 - I like green soup - active</li>
<li>4324234 - I like orange soup - active</li>
<li>123123 - I like hands - active</li>
</ul>
My JSON response from the server:
[{"project":{"name":"3rd project XXXX","created_at":"2010-09-21T05:00:28Z","updated_at":"2010-09-21T05:00:28Z","site_id":1,"creator":1,"id":3,"description":"I eat chicken","active":true}},{"project":{"name":"It's 10:11pm2","created_at":"2010-09-21T05:11:25Z","updated_at":"2010-09-21T05:22:07Z","site_id":1,"creator":1,"id":7,"description":"It's 10:11pmIt's 10:11pm22","active":true}},{"project":{"name":"My first project","created_at":"2010-09-21T04:15:54Z","updated_at":"2010-09-21T04:15:54Z","site_id":1,"creator":1,"id":1,"description":"Wowwww","active":true}},{"project":{"name":"What a great project","created_at":"2010-09-21T04:16:07Z","updated_at":"2010-09-21T04:58:24Z","site_id":1,"creator":1,"id":2,"description":"Updated Description2","active":true}},{"project":{"name":"the big 6","created_at":"2010-09-21T05:08:22Z","updated_at":"2010-09-21T05:08:22Z","site_id":1,"creator":1,"id":6,"description":"the big 6the big 6","active":true}}]