~ overflow ~

Google Maps API blank screen when loaded dinamically

by z3n on Feb.19, 2009, under Coding

Problem:

this:

$.getScript(“http://maps.google.com/maps?file=googleapi&v=2&key=<?=_gkey?>”,function(){something});

will execute the callback and then go to a blank a screen.

Solution:

Apparently, googlemaps api has it’s own onLoad feature which screws up with dynamic js loading, so what you have to do is add the callback on the query:

function gmaps_dloader(){$.getScript(“http://maps.google.com/maps?file=googleapi&v=2&key=<?=_gkey?>&callback=happy_function“);}

function happy_function(){alert(“HOY!!!”);}

if you need callbacks so much you may also add the jQuery’s, both will be executed.

:, , ,


2 comments for this entry:
  1. Troy Daniel

    You saved me a$$. Thanks duded – solid find.

  2. Willks

    Thanks man, why isn’t this info more easily found! Excellent post!

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!