Re: [Google Maps API v3] Error: 'google' is undefined

3,047 views
Skip to first unread message
Message has been deleted

Chris Broadfoot

unread,
Aug 17, 2011, 5:05:37 AM8/17/11
to google-map...@googlegroups.com
Hi Stephen,

Looks like your scripts are ordered incorrectly. I see:

<script type="text/javascript" src="http://www.thurstontalk.com/wp-content/w3tc/min/3c51652e.6ed1a0.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>

You'll want to load the dependencies of your script first (e.g. Maps API, Google AJAX API, jQuery)

Chris

--


On Wed, Aug 17, 2011 at 3:10 PM, Stephen Backholm <sbac...@gmail.com> wrote:
Site: http://tinyurl.com/4ycf69e

My site works on my local machine, but when I upload it to my live site it doesn't render and debugging shows that I get a "'google' is undefined" error on the line:

google.load('visualization','1',{});


I have the following items included between the head tags, before the call to google.load:

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

I am guessing that due to the asynchronous nature of the google.load call it is being called too early, but all attempts to ensure proper loading order have failed.

Any ideas or suggestions are appreciated.


Regards,
Stephen


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/RMIvt7U6UWgJ.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Stephen Backholm

unread,
Aug 17, 2011, 10:19:15 AM8/17/11
to google-map...@googlegroups.com
Chris,

Thanks for taking a look.

The first script is unrelated to the map code.


<script type="text/javascript" src="http://www.thurstontalk.com/wp-content/w3tc/min/3c51652e.6ed1a0.js"></script>

The map script calls are as follows, but the last one doesn't show up due to the error.  You'll see it when you debug, but it doesn't show in the source.


<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://www.thurstontalk.com/wp-content/js/map/ttmap.js"></script>


Thanks.

Regards,
Stephen

Stephen Backholm

unread,
Aug 17, 2011, 11:11:21 AM8/17/11
to google-map...@googlegroups.com
Chris,

You're were exactly right.  Wordpress was manipulating and renaming my script calls, and the call I didn't recognize was actually my script.

Thanks for solving this.  One of those mental block moments that needed a fresh set of eyes.

Regards,
Stephen

hanef fajer Road

unread,
Aug 17, 2011, 6:16:47 PM8/17/11
to google-map...@googlegroups.com
is there problem??i make marker with dynamic infowindow information
and it show,but when i updating database using MySQL for My windows
information and place of marker, my map couldn't show again.. :(

Chris Broadfoot

unread,
Aug 17, 2011, 7:35:33 PM8/17/11
to google-map...@googlegroups.com
No problem!

It's always best to see what the live output looks like. When using frameworks like Wordpress, they'll often do clever (no sarcasm!) things that may be surprising.

Cheers


Regards,
Stephen

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
Reply all
Reply to author
Forward
0 new messages