I need to call a particular PHP script on my server several times. As each call will take some time (e.g. about .5 seconds) and each call is independent of each other, I want to call the scripts concurrently. Right now, I have something like this:
$(document).ready(function() {
    $.ajax({
      url: 'main.php',
      method: 'POST',
      data: { foo: 'foo' },
      success: function(result) {
        console.log(result);
      }
    });
    $.ajax({
      url: 'main.php',
      method: 'POST',
      data: { bar: 'bar' },
      success: function(result) {
        console.log(result);
      }
    });
});
Instead of making these calls sequentially, I want to do them concurrently. How do I do that?
 
     
     
     
    