title: ajax return value for function
body: <p>Why doesn't this return a value when the function is called? I've tried it with callbacks, and I can't seem to get it to work either.  It lets me console.log, but it just won't return it to the <code>tmp</code> variable.</p>
  
  <pre><code>var URL = "https://api.instagram.com/v1/media/popular?client_id=642176ece1e7445e99244cec26f4de1f";
  
  function getData(){
    var tmp;
      $.ajax({
           type: "GET",
           url: URL,
           dataType: "jsonp",
           success: function(result){
            if(result.meta.code == 200){
              tmp = result.data;
              //console.log(result.data);
            }else{
              alert('fail');
              alert(result.meta.error_message);
            }
           }
      });
      return tmp;
  }
  console.log(getData()); // undefined?
  </code></pre>
  
  <p>thanks in advance!</p>