Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem, of course, was WHERE my loop was. I was looping too soon and calling all my initially iterated variables d times (d being the number of items in my nested loop).</p> <p>Here's the solution:</p> <pre><code>var d = { "data": [{ "Claim": { "img_url": null, "id": "4", "user_id": "3", "claim_status": "started", "exp": "Sep 30, 2013" }, "User": { "score": "0", "id": "3" }, "ClaimResponse": [{ "id": "32", "claim_id": "4", "user_id": "14", "created": "2013-06-10 03:18:35", "modified": "2013-06-10 03:18:35" }, { "id": "107", "claim_id": "4", "user_id": "8", "created": "2013-06-28 02:37:10", "modified": "2013-06-28 02:37:10" }, { "id": "140", "claim_id": "4", "user_id": "976", "created": "2013-06-28 04:19:22", "modified": "2013-06-28 04:19:22" }, { "id": "152", "claim_id": "4", "user_id": "19", "created": "2013-07-03 02:27:12", "modified": "2013-07-03 02:27:12" }, { "id": "154", "claim_id": "4", "user_id": "1158", "created": "2013-07-05 03:16:48", "modified": "2013-07-05 03:16:48" }], "participants": { "14": { "user_id": "14", "twitter_image_url": "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png" }, "8": { "user_id": "8", "twitter_image_url": "https://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_3_normal.png" }, "19": { "user_id": "19", "twitter_image_url": "https://si0.twimg.com/sticky/default_profile_images/default_profile_2_normal.png" }, "1158": { "user_id": "1158", "twitter_image_url": "https://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_5_normal.png" } }, "viewer": { "isResponsed": false, "isOwner": false, "lockedInPoint": 0, "response": null, "cut_loss": false, "cut_loss_price": null } }, { "Claim": { "img_url": null, "id": "133", "user_id": "14", "claim_status": "started", "exp": "Jul 15, 2013" }, "User": { "score": "-40", "id": "14" }, "ClaimResponse": [{ "id": "172", "claim_id": "133", "user_id": "8", "created": "2013-07-12 20:36:16", "modified": "2013-07-12 20:36:16" }, { "id": "176", "claim_id": "133", "user_id": "1159", "created": "2013-07-13 02:52:31", "modified": "2013-07-13 02:52:31" }], "participants": { "8": { "user_id": "8", "twitter_image_url": "https://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_5_normal.png" }, "1159": { "user_id": "1159", "twitter_image_url": "https://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_5_normal.png" } }, "viewer": { "isResponsed": false, "isOwner": false, "lockedInPoint": 0, "response": null, "cut_loss": false, "cut_loss_price": null } }], "errors": [], "success": true, "code": 200 } $.each(d.data, function (i, x) { id = x.Claim.id; $('body').append('&lt;div class="id"&gt;&lt;p id="img'+x.Claim.id+'"&gt;Claim' + x.Claim.id + '&lt;/p&gt;&lt;/div&gt;'); $.each(x.participants, function (i, p) { $('#img'+x.Claim.id).append('&lt;img src="' + p.twitter_image_url + '"/&gt;'); }); }); </code></pre> <p><a href="http://jsfiddle.net/gkGP4/6/" rel="nofollow">http://jsfiddle.net/gkGP4/6/</a></p> <p>Thanks to all for the various approaches.</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.
 

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