Loading Google Maps asynchronously with infobox error -
i have been trying fix since yesterday can't head around it. loading google map asynchronously following code brings error due infobox not being loaded correctly.
my error is: infobox not defined
my code is:
function loadscript(callback) { var map = document.createelement('script'); map.type = 'text/javascript'; map.src = 'https://maps.googleapis.com/maps/api/js?key=my_key_goes_here&sensor=false&callback=initialize'; document.body.appendchild(map); map.onload = function() { var box = document.createelement('script'); box.type = 'text/javascript'; box.src = 'https://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox_packed.js'; document.body.appendchild(box); box.onload = callback; }; } window.onload = loadscript;
you specify argument loadscript, 'callback'. in map.src specify callback=initialize
. call loadscript on window.onload, don't specify argument it. box.onload doesn't know value callback
i'm guessing, can't magically guess 'initialize' map.src string.
make sense?