title: How to wait until jQuery ajax request finishes in a loop?
body: <p>I have that code :</p>
  
  <pre><code>for (var i = 0; i &lt; $total_files; i++) {
    $.ajax({
      type: 'POST',
      url: 'uploading.php',
      context: $(this),
      dataType: 'json',
      cache: false,
      contentType: false,
      processData: false,
      data: data_string,
      success: function(datas) {
        //does something
      },
      error: function(e) {
        alert('error, try again');
      }
    });
  }
  </code></pre>
  
  <p>It uploads images very well but the problem is that I can't find a way to upload the images one by one, I tried to put the option <strong>async to false</strong> but it freezes the web browser until all images are uploaded which is not what I want, I want to emulate somehow this <strong>"async : false"</strong> option to perform the same thing but without freezing the web browser.</p>
  
  <p>How to do this ?</p>