title: How to do asyncrhonous jQuery.get() before $(window).load()?
body: <p>I want a SVG file to be loaded in a variable before $(window).load() will be fired.</p>
  
  <p>I load the file using jQuery.get(). The problem is, that this function works asynchronously and by the time, when the SVG file is read, the $(window).load() is already invoked.</p>
  
  <p>So I have following code: </p>
  
  <pre><code>var data;
  
  $(document).ready(function () {
      jQuery.get(
          "my.svg",
          function (_data) {
              data = _data;
          },
          'text');
  });
  
  
  $(window).load( function () {
      alert(data);
  });
  </code></pre>
  
  <p>The alert will show "undefined". If it will be invoked later (after 5 seconds for example) then it will show the content of the SVG file.</p>
  
  <p>Any suggestions? Thanks!</p>