title: Passing data outside ajax call, jQuery
body: <p>I'm getting vimeo thumbnails from the API and I'm using a jQuery function to append the data to the dom. </p>
  
  <p>I'm trying to access <strong>thumb_url</strong> outside ajax, so I can return it to jQuery, but it doesn't work. </p>
  
  <pre><code>function getThumb(vimeoVideoID) {
  var thumb_url;
  
  $.ajax({
      type: 'GET',
      url: 'http://vimeo.com/api/v2/video/' + vimeoVideoID + '.json',
      jsonp: 'callback',
      dataType: 'jsonp',
      success: function (data) {
          console.log(data[0].thumbnail_large);
          thumb_url = data[0].thumbnail_large;
      }
  });
  return thumb_url;
  }
  
  $('.video').each(function () {
  var thumb_url = getThumb(this.id);
  $(this).append('&lt;img src="' + thumb_url + '" class="video_preview"/&gt;');
  
  });
  </code></pre>
  
  <p>Fiddle: <a href="http://jsfiddle.net/gyQS4/2/" rel="noreferrer">http://jsfiddle.net/gyQS4/2/</a>
  help?</p>