Note that there are some explanatory texts on larger screens.

plurals
  1. POloop over an object and append to a container
    primarykey
    data
    text
    <p>In jQuery how would I get the 'itemName' for each in DATA and append it to posts-container? </p> <p>so I would have html like this.....</p> <p>title: wow just seen this</p> <p>title: test</p> <p>etc....</p> <p>Thanks</p> <p>Json</p> <pre><code>{ "ERRORS": [], "DATA": [ { "itemID": "012be513-9b2d-4ed6-9b84-4097a610a823", "itemValidTo": "October, 29 2011 00:00:00", "itemName": "wow just seen this", "image": { "imageCreated": "October, 06 2011 00:00:00", "imageURL": "ha.jpg", "imageID": "16fbdb40-8591-4a3b-b18e-bda494ac213f" }, "itemActive": true, "createdBy": { "UserID": "DA1F154B-EF46-49BD-18C84C49478AD48E", "accNumber": "" }, "itemTxt": "SO impressed with this!", "itemModified": "October, 06 2011 00:00:00" }, { "itemID": "30d2f2c1-58ca-4b3d-b3e0-d284ae5b25ab", "itemName": "test", "image": { "imageCreated": "October, 05 2011 00:00:00", "imageURL": "image.jpg", "imageID": "bc869a94-fee5-4fc8-bd21-e2de2f020310" }, "itemActive": true, "createdBy": { "UserID": "DA1F154B-EF46-49BD-18C84C49478AD48E" }, "itemTxt": "test", "itemModified": "October, 05 2011 00:00:00" } ], "MESSAGES": [ { "TOTAL": 2, "CURRENTPAGE": 1, "TOTALPAGES": 1 } ] } </code></pre> <p>script</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $.ajax({ type: 'get', url: 'http://do.com/api/id/123', dataType: 'json', data: '', success: function(r){ $('#waiting').hide(500); var output = ''; //loop here and add append I assume? jQuery('#posts-container').append(output); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); return false; }); </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload