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.
November 18th, 2010 on 12:44
You saved me a$$. Thanks duded – solid find.
April 1st, 2012 on 2:34
Thanks man, why isn’t this info more easily found! Excellent post!