title: Using getScript synchronously
body: <p>I'm writing an engine that requires the use of getScript quite extensively. I've pushed it into its own function, for ease of use, but now I need to make sure that the function itself is synchronous. Unfortunately, I can't seem to make getScript wait until the script it loads is actually finished loading before proceeding. I've even tried setting jQuery's ajax asynch property to false before making the call. I'm thinking of using jQuery's when/done protocol, but I can't seem to wrap my head around the logic of placing it inside a function and making the function itself synchronous. Any help would be very much appreciated!</p>
  
  <pre><code>function loadScript(script){
  //Unrelated stuff here!!!
  $.when(
  $.getScript(script,function(){
      //Unrelated stuff here!!!
  })).done(function(){
      //Wait until done, then finish function
  });
  }
  </code></pre>
  
  <p>Loop code (by request):</p>
  
  <pre><code>for (var i in divlist){
          switch($("#"+divlist[i]).css({"background-color"})){
              case #FFF:
              loadScript(scriptlist[0],divlist[i]);
              break;
          case #000:
              loadScript(scriptlist[2],divlist[i]);
              break;
          case #333:
              loadScript(scriptlist[3],divlist[i]);
              break;
          case #777:
              loadScript(scriptlist[4],divlist[i]);
              break;
      }
  }
  </code></pre>