title: Difference between Jquery $(window).load vs window.onload
body: <p>I have the following code:</p>
  
  <pre><code>function initialize() {
    var mapOptions = {
      center: new google.maps.LatLng(53.743317, -0.331004),
      zoom: 12
    };
    var map = new google.maps.Map(document.getElementById("map-canvas"),  mapOptions);
  }
  
  function loadScript() {
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = 'https://maps.googleapis.com/maps/api/js?key={APIKEY}&amp;sensor=false&amp;callback=initialize';
    document.body.appendChild(script);
  }
  </code></pre>
  
  <p>If I put</p>
  
  <pre><code>$( window ).load(function() {
      loadScript;
  });
  </code></pre>
  
  <p>It won't load my map.  Error in google maps js is <code>Uncaught TypeError: Object #&lt;Object&gt; has no method 'Load'</code>. However if I use</p>
  
  <pre><code>window.onload = loadScript;
  </code></pre>
  
  <p>It will load it in fine.  I have absolutely no idea why.</p>
  
  <pre><code>$(window).load(loadScript());
  </code></pre>
  
  <p>Also works, just having it as a function that calls it doesn't. Could you tell me the reason of this behavior?</p>