title: Javascript/Jquery Unable to set dom element to ajax result
body: <p>I making an ajax request on a json file then running a 'for loop' that loops through the file and displays the necessary information on a webpage. The function should also be displaying the result of a second ajax request in an html element. I can console.log the result but am unable to set the result into an html element.</p>
  
  <p>I've tried various different approaches like creating arrays then pushing the results, everything I have tried failed.</p>
  
  <p>HTML</p>
  
  <pre class="lang-html prettyprint-override"><code>$.getJSON("coins.json", function(result) {
        for (var i = 0; i &lt; result.length; i++) {
          name = result[i].name;
          ticker = result[i].ticker;
          amount = result[i].amount;
          icon = result[i].icon;
          $('.coins').append("&lt;div class='coin'&gt;&lt;div class='cname'&gt;&lt;img src='" + icon + "' /&gt;&lt;h1&gt;" + name + "&lt;/h1&gt;&lt;p&gt;Ticker : " + ticker + "&lt; /
            p &gt; &lt; h2 &gt; "+$.getJSON(result[i].price, function(coinPrice){ console.log(coinPrice.ticker.price); })+" &lt; /h2&gt;&lt;/div &gt; &lt; /div&gt;");
          }
        });
  </code></pre>
  
  <p>Console outputs results properly but </p>
  
  <pre><code>$(this).text(coinPrice.ticker.price)
  </code></pre>
  
  <p>displays </p>
  
  <p><code>[object Object]
  </code></p>
  
  <p>coins.json</p>
  
  <pre><code>[
    {
      "name": "Bitcoin",
      "ticker": "BTC",
      "amount": 0.17,
      "icon": "https://raw.githubusercontent.com/atomiclabs/cryptocurrency-icons/master/128/black/btc.png",
      "price": "https://api.cryptonator.com/api/ticker/btc-aud"
    },
    {
      "name": "Ethereum",
      "ticker": "ETH",
      "amount": 59,
      "icon": "https://raw.githubusercontent.com/atomiclabs/cryptocurrency-icons/master/128/black/eth.png",
      "price": "https://api.cryptonator.com/api/ticker/eth-aud"
    },
    {
      "name": "Neo",
      "ticker": "NEO",
      "amount": 88,
      "icon": "https://raw.githubusercontent.com/atomiclabs/cryptocurrency-icons/master/128/black/neo.png",
      "price": "https://api.cryptonator.com/api/ticker/neo-aud"
    }
  ]
  
  </code></pre>
  
  <p>I wish to select the price object in the coins.json make an ajax request and display its value in a html element. Please help</p>