-2

I've looked at SO and implemented the answer in the actual question.

But get the error:

Uncaught ReferenceError: google is not defined

I'm adding my map by embedding an iframe, also my JS is not run until

$(document).ready(function(){

So where am I going wrong?

Community
  • 1
  • 1
panthro
  • 22,779
  • 66
  • 183
  • 324

1 Answers1

-1

I think google check you APIKEY before.

Try the method describe in the documentation passing a callback inside the scrips tag ;)

  <script type="text/javascript">

var map;
function initMap() {
  map = new google.maps.Map(document.getElementById('map'), {
    center: {lat: -34.397, lng: 150.644},
    zoom: 8
  });
}

</script>
<script async defer
      src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
    </script>
Steeve Pitis
  • 4,283
  • 1
  • 21
  • 24