Query string parameter handling when loading a script using $.getScript
<p>I have a dynamic list of scripts that needs to be loaded and the callback function calls another async function defined in the loaded external script. </p>

<p>A script object consists of {scriptUrl, property}</p>

<p>All scripts have a externalScriptFunction function defined, that take script['property'] as a parameter.</p>

<pre class="lang-js prettyprint-override"><code>for(var i = 0; i &lt; scripts.length; i++) {
   var script = scripts[i];

   $.getScript(script['scriptUrl'], function() {
      externalScriptFunction(script['property'], function someAsyncMethod() {
         ...
         ...
      });

   })

}
</code></pre>

<p>The issue I am having is that before the $.getScript callback is executed, the for loop has advanced to the next element and script['property'] is from a different element of the array. </p>

<p>How do I solve this issue? </p>

<ul>
<li>Is there some way to pass a query parameter to the loaded script?</li>
<li>Or a way for the $.getScript to finish loading the script before moving to the next item?</li>
<li>Any other solutions?</li>
</ul>

<p>Thanks!</p>
