title: Jquery Deferred. Multiple ajax calls. deferred vs async false
body: <p>I've got the following. </p>
  
  <pre><code>var lookupInit = function () {            
          http.get('api/employmenttype', null, false)
              .done(function (response) {
                  console.log('loaded: employmenttype');
                  vm.lookups.allEmploymentTypes(response);
              });    
          http.get('api/actionlist', null, false)
              .done(function (response) {
                  console.log('loaded: actionlist');
                  vm.lookups.allActionListOptions(response);
              });    
          http.get('api/company', null, false)
              .done(function (response) {
                  console.log('loaded: company');
                  vm.lookups.allCompanies(response);
              });    
  
          //... x 5 more
          return true;
      };
  
  
  
  // somewhere else
    if (lookupInit(id)) {
          vm.userInfo.BusinessUnitID('0');
          vm.userInfo.BuildingCode('0');
  
            if (id === undefined) {
                  console.log('api/adimport: latest');
                  http.json('api/adimport', { by: "latest" }, false).done(viewInit);
            }
            else if (id !== undefined) {
                  console.log('api/adimport: transaction');
                  http.json('api/adimport', { by: "transaction", TransactionId: id }, false).done(viewInit);
            }
    } else {
        console.log('User info init failed!');
    }
  </code></pre>
  
  <p>The following "http.get('api/employmenttype', null, <strong>false</strong>)" means i set async to false.
  I'm aware that this is probably inefficient. And i'd like to have all the calls load simultaneously.
  The only problem is if i don't have them set to async false, the second part of my code might execute before the dropdowns are populated.</p>
  
  <p>I've tried a couple of attempts with Jquery Deferreds, but they have resulted in what i can only describe as an abortion. </p>
  
  <p>The only thing i'm looking to achieve is that the lookup calls finish before the adimport/second part of my code, in any order.... But having each call wait for the one before it to finish EG: async, seems like the only solution I'm capable of implementing decently ATM.</p>
  
  <p><strong>Would this be an appropriate place for deferred function, and could anyone  point me into a direction where i could figure out how to implement it correctly, as I've never done this before?</strong></p>