Multiple ajax request

Multiple ajax request

Hi,

I'm trying to launch two ajax requests at same time. I'm expecting result from the first later than the second. The problem is, it won't return me any result from the second request untill first one is returned.

Check it out :

  1. $.post("sendMail.php");
  2. getSendInfo();
  3. setTimeout(getSendInfo,5000);


  4. function getSendInfo(){
  5.         $.getJSON("getSendInfo.php",
  6.         function(data){
  7.                 console.log("done");
  8. });
    }

I'm getting response from the $.getJSON function only when the $.post is over. Is this a bug or a mistake from me ? My aim is to launch a long request and fire multiple other requests to check how is doing the first one.

Can someone help me with that ?