title: How do I reload the page after all ajax calls complete?
body: <p>The first time a user is visiting my website, I am pulling a lot of information from various sources using a couple of ajax calls. How do I reload the page once the ajax calls are done? </p>
  
  <pre><code>if(userVisit != 1) {
    // First time visitor
    populateData();
  }
  
  function populateData() {
    $.ajax({
              url: "server.php",
              data: "action=prepare&amp;myid=" + id,
              dataType: "json",
              success: function(json) {
                  if(json.error) { 
                      return;
                  }
                  _id = response[json].id;
                  getInformation(_id);
              }
    });
  }
  
  function getInformation(id) {
    $.ajax({
              url: "REMOTESERVICE",
              data: "action=get&amp;id=" + id,
              dataType: "json",
              success: function(json) {
                  if(json.error) { 
                      return;
                  }
  
                  $.ajax({
                         url: "server.php",
                         data: "action=update&amp;myid=" + id + '&amp;data=' + json.data.toString(),
                         dataType: "json",
                         success: function(json) {
                                  if(json.error) { 
                                      return;
                                  }
                        }
                  });
              }
    });
  }
  </code></pre>
  
  <p>So what the code does is, it gets a list of predefined identifiers for a new user (<code>populateData</code> function) and uses them to get more information from a thirdparty service (<code>getInformation</code> function). This <code>getInformation</code> function queries a third party server and once the server returns some data, it sends that data to my server through another ajax call. Now what I need is a way to figure out when all the ajax calls have been completed so that I can reload the page. Any suggestions?</p>