title: jquery ajax synchronous call beforeSend
body: <p>I have a function called:</p>
  
  <pre><code>function callAjax(url, data) {
   $.ajax(
     {
       url: url, // same domain
       data: data,
       cache: false,
       async: false, // use sync results
       beforeSend: function() {
         // show loading indicator
       },
       success: function() {
         // remove loading indicator 
       }
     }
    );
  }
  </code></pre>
  
  <p>In the code, I call "callAjax" X number of times and I want to update the data synchronously. It is done as expected, but one problem: the loading item doesn't show in beforeSend function. If I turn async to true, it works but the updates aren't synchronously done. </p>
  
  <p>I've tried several things with no success. I tried putting the loading indicator before the ajax call like this:</p>
  
  <pre><code>function callAjax(url, data) {
    // show loading div
  
    $.ajax(
      {
        // same as above
      }
     );
  }
  </code></pre>
  
  <p>But for some reason it doesn't want to show the loading indicator. I notice a strange behavior when I put an "alert" in the beforeSend and the loading indicator appears in that case, but I rather not pop up a message box. </p>
  
  <p>Got any ideas?</p>