Hi, Im trying to load the google maps api's dynamically. I'm using the following code:
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'http://www.google.com/jsapi?key=<MY_KEY>;
head.appendChild(script);
but when trying to create the map
map = new GMap2(document.getElementById("map"));
or
map = new google.maps.Map2(document.getElementById("map"));
I'm getting an error that google (or GMap2) is undefined.