title: Pass the value of an xhr onload function globally
body: <p>In an app I'm creating I have the below XMLHttpRequest and I'm trying to pass the results of <code>data</code> inside the <code>xhr.onload()</code> into an array that's created within the same parent function.</p>
  
  <pre><code>var url = 'http://api.soundcloud.com/resolve.json?'+resource+'&amp;'+CLIENT_ID;
  var xhr = new XMLHttpRequest();
  xhr.open('GET', url, true);
  xhr.onload = function(){
      var data = JSON.parse(xhr.responseText);
      console.log(data.permalink_url);
  };
  xhr.send();
  </code></pre>
  
  <p>Below this I have the building blocks of an array and I'm trying to pass the results of data into the track string. </p>
  
  <pre><code>var metadata = {
          id: val,
          title: title,
          url: posturl,
          track: data.permalink_url
        };
  </code></pre>
  
  <p>Everything I've tried thus far either returns <code>undefined</code> or <code>function</code> and now I'm totally out of ideas...</p>