title: Need to wait until XMLHttpRequest completes
body: <p>Whenever I try to find answer of this question everyone refers to ajax start/stop etc.</p>
  
  <p>I am using <a href="http://xuijs.com/docs/xhr" rel="nofollow">XUI JS's XHR</a> function for cross domain calling, now I want exactly like this</p>
  
  <pre><code>callMyXHRfunction();
  callNextFunctionWhenAboveFunctionResponded();
  </code></pre>
  
  <p>i.e. I should move forward until unless my xhr function responds (either success or failure)</p>
  
  <p><strong>Update</strong></p>
  
  <p>Use Case:</p>
  
  <p>There is a function called getAllData(), this function get all my current data submitted to server. I need to call this function often to get the latest data and move ahead. While loggin I call this function to get latest data and after every 10 mins I need to call this to get data refreshed.</p>
  
  <p>So if I call each my function on success function then my code may confuse other developer and if I write like above he/she will easily know what is going on in first line and in 2nd line.</p>
  
  <p>Hope now everyone understand my situation very well.</p>