Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery get link values from data object
    text
    copied!<p>I can't for the life of me figure out how to access the values inside this object. Any help would be much apreciated</p> <p>End goal, once I can access the link, i'll iterate each and append and img tag to the dom after the images-header element.</p> <p><strong>JS to consume json</strong></p> <pre><code>$("#stack_name").focusout(function() { var name = $(this).val(); // alert(name); $.getJSON('/images.json?name='+ name, function(data) { console.log("DATA: ", data); // $('&lt;p&gt;Test&lt;/p&gt;').appendTo('.images-header'); }); }); </code></pre> <p><strong>Console Log outputs:</strong></p> <pre><code>DATA: Object {data: Object} data: Object images: Array[4] 0: "http://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Connecticut_in_United_States.svg/270px-Connecticut_in_United_States.svg.png" 1: "http://www.enchantedlearning.com/usa/states/connecticut/map.GIF" 2: "https://familysearch.org/learn/wiki/en/images/0/01/Connecticut-county-map.gif" 3: "http://www.ct.gov/ecd/lib/ecd/20/14/state%2520of%2520connecticut%2520county%2520outline.jpg" length: 4 __proto__: Array[0] __proto__: Object __proto__: Object app-init.js?body=1:15 </code></pre> <p><img src="https://i.stack.imgur.com/D8UuX.jpg" alt="enter image description here"></p> <p><strong>/images.json?name=connecticut</strong></p> <pre><code>{ "data": { "images": [ "http://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Connecticut_in_United_States.svg/270px-Connecticut_in_United_States.svg.png", "http://www.enchantedlearning.com/usa/states/connecticut/map.GIF", "https://familysearch.org/learn/wiki/en/images/0/01/Connecticut-county-map.gif", "http://www.ct.gov/ecd/lib/ecd/20/14/state%2520of%2520connecticut%2520county%2520outline.jpg" ] } } </code></pre>
 

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