Call Jquery Function from BookMarklet script
<p>I have a bookmarklet that runs a .js file.  I now want to split that .js file into more focused modules.</p>

<p>In scriptA I am using the following code to load scriptB:</p>

<pre><code> $.getScript("LoadXML.js")(function(){ 
     loadAllXML() 
 });
</code></pre>

<p>This function is in scriptB:</p>

<pre><code>function loadAllXML() {
  $.ajax({
      type: "GET",
      url: "/dataSource.xml",
      dataType: "xml",
      success: function (xml) {
         //how to return xml to ScriptA?
      }
  });        
}
</code></pre>

<p>I think the code in scriptA is continuing to run before the loadAllXML has completed so have tried things like jquery's <a href="http://api.jquery.com/jQuery.when/" rel="nofollow">when</a> but have had no joy.</p>

<p>How do I return the xml to scriptA?  </p>

<p>Also, how do I make calls to loadAllXML() from outside $.getScript?</p>

<p>Thanks</p>
