title: Google Map API V3 - ReferenceError: google is not defined
body: <p>I am learning to create google maps by studying the basic examples from <a href="https://developers.google.com/maps/documentation/javascript/examples/map-simple-async" rel="noreferrer">google</a>.</p>
  
  <p>I basically copied and pasted the scripts in the head tags and the firebug console returned the following error:</p>
  
  <pre><code>ReferenceError: google is not defined
  </code></pre>
  
  <p>I have the following several scripts loaded in the head along with the google map scripts. Not sure why it throws me the error.</p>
  
  <pre><code>&lt;head&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"&gt;&lt;/script&gt;
  
      &lt;!-- nmr is used to write my own scripts --&gt;
      &lt;script&gt;var nmr = jQuery.noConflict();&lt;/script&gt;
  
      &lt;!-- Google Map scripts --&gt;
      &lt;script&gt;
          function initialize() {
              var mapOptions = {
                  zoom: 13,
                  center: new google.maps.LatLng(-34.397, 150.644),
                  mapTypeId: google.maps.MapTypeId.ROADMAP
              };
  
              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=AIzaSyB7CgOuhFLDkh2VAGW1S2Y" + "sensor=false" + "callback=initialize";
              document.body.appendChild(script);
          }
  
          window.onload = loadScript;
  
      &lt;/script&gt;
  </code></pre>
  
  <p></p>
  
  <p>I also tried to add this before the initialize function, but it didn't work.</p>
  
  <pre><code>&lt;script&gt; var google = jQuery.noConflict(); &lt;/script&gt;
  </code></pre>
  
  <p>Can anyone help? Thanks!</p>