Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps v3, error message "Google is undefined"

I am getting errors on my site just trying to implement the basic "Hello world" application:

<div id="map"></div> 

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>

$(document).ready(function () {
    map = new google.maps.Map(document.getElementById("map"), myOptions);
});

The error I get is:

'Uncaught ReferenceError: google is not defined'

How do I fix this problem?

like image 623
user499846 Avatar asked Feb 12 '26 15:02

user499846


1 Answers

Your source is wrong, I also suggest specifing the exact version you want to load:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3&sensor=true"></script>

That should help.

like image 63
tpeczek Avatar answered Feb 15 '26 04:02

tpeczek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!