I have been trying to fix this since yesterday but I can't get my head around it. I am loading my google map asynchronously but The following code brings up an error which is due to the infobox not being loaded correctly.
My error is: InfoBox is 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;