title: JavaScript load JSON data from an API url
body: <p>I'm working on a javascript program that needs to get data from an API.</p>
  
  <p>My problem is I'm not able to go from the url string to the actual JSON data.</p>
  
  <p>I've looked <a href="https://stackoverflow.com/questions/13494490/passing-json-data-from-an-api-to-a-javascript-variable">here</a> and they provide this answer :</p>
  
  <p><strong>Put your JSON string a variable var jsonString</strong></p>
  
  <p><strong>then...</strong></p>
  
  <p><strong>var myJsonObject = JSON.parse(jsonString);</strong></p>
  
  <p>So I ended up with : </p>
  
  <pre><code>var url = "https://pixabay.com/api/?";
  
  var data = JSON.parse(url);
  </code></pre>
  
  <p>But this is not working. I'm sure I'm missing something obvious but I can't see what. </p>
  
  <p>Any help would be greatly appreciated, thanks !</p>