Procedural order of jQuery functions inside JS
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3393751/what-does-asynchronous-means-in-ajax">What does Asynchronous means in Ajax?</a><br>
  <a href="http://stackoverflow.com/questions/4982983/jquery-ajax-return-value">jQuery ajax return value</a>  </p>
</blockquote>



<p>Trying to do a function that contains a jQuery function (<code>getJson()</code>) as part of it, but when I run it, my javascript function returns <em>before</em> calling the <code>getJson()</code>. I want to know why the getJson is not being called in order, and how to fix it.</p>

<pre><code>function getUsers(screen_name){
user_list=[]  
var id_list =[]

    $.getJSON(url,  function(json)
    {   
        //do stuff here, I have breakpoint #1 here
    });

    return user_list //breakpoint #2 is here
}
</code></pre>

<p>When running it from the console: <code>getUsers('myUser')</code> it firsts gets to breakpoint #2 and then to breakpoint #1.</p>
