Hi,
I want to use the V3 API. I have got the program partially working.
If the code is embeded in the main page, then the call to the google
code will work. What I am at now is how do I dynamically generate
(function loadMap) and insert the callback function that is to be
called by the loadScript() function. In the example below I can
loadScript() from the onclick that is generated by my AJAX call but
how do I insert the loadMap in my AJAX call as it is ignored by the
called (I can see the code in the browser debugger) but get an Error
Object expected error when called.. Thanks.
<script type="text/javascript">
var map;
//<![CDATA[
function loadMap() {
var latlng = new google.maps.LatLng(-34.397,
150.644);
var myOptions = { zoom: 10, center: latlng,
mapTypeId:
google.maps.MapTypeId.ROADMAP };
map = new google.maps.Map(document.getElementById
('divmap'),myOptions);
}
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.google.com/maps/api/js?
sensor=false&callback=loadMap";
document.body.appendChild(script);
}
//]]>
</script>
On Sep 28, 5:54 pm, Rossko <[email protected]> wrote:
> > What I cannot achieve is to
> > dynamically call the google maps API via the AJAX call.
>
> You need to decide if you're going to use v2 or v3 first.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---