Your map variable needs to be declared in a global scope. Example:

var map;
function MapInitialize() {
map = new google.maps.Map(document.getElementById("map_canvass"),
myOptions);
}

Then your map variable will be in scope in your ajax callback
function.

Chad Killingsworth

On Nov 10, 2:54 pm, BobD <[email protected]> wrote:
> Hi, newbie question. I have an href link on my html page next to the
> map object. The map object is created as standard on page load;
>
> map = new google.maps.Map(document.getElementById("map_canvass"),
> myOptions);
>
> When I click on my href link next to the map I perform an ajax call to
> some backend PHP. When the ajax callback is invoked I would like to
> update the latlng using setCenter on the map API.
>
> My problem is I dont know how to get a valid map object in the context
> of the ajax callback.
>
> I tried;
>
> map = document.getElementById("map_canvas");
> but when I call setCenter on I get a "map is null or not an object"
> error.
>
> Appreciate any assistance.
>
> Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to