views:

40

answers:

2

Hi, i have the following code to update a google map:

function updateit(c1,c2){
alert(c1+"-"+c2); // This works
map.setCenter(new GLatLng(c1, c2), 13); // But this doesn't
}

updateit(37.4419, -122.1419);

The alert is working and show the two coordinations, but i think the GLatLng() doesn't receive them, so the map is not updated unless i directly declare them as strings :

function updateit(c1,c2){
map.setCenter(new GLatLng(37.4419, -122.1419), 13); // This works
}

How to fix this problem?

Thanks

+1  A: 

Dude, this really isn't enough

This code could be all your app does - logically it isn't and so much more is happening around it.

This looks absolutely sound. I'm simply guessing you have c1 and c2 mixed up. what does your alert say?

37.4419, -122.1419 heads straight to 1708 Fulton St

reverse them and it goes no where. Google maps does not find -122.1419, 37.4419

check that buddy.

Glycerine
You are right! i really reversed them and spent hours finding the solution XD
David
its easily done - I was spitting feathers today to the reason why my route was going backwards - "BUT I SAID GLASGOW TO EDINBURGH!!!", got my fields back to front o_O
Glycerine
A: 

Are you using the Google AJAX API Loader? If so I believe you have to use the google.maps.* namespace:

map.setCenter(new google.maps.LatLng(c1, c2), 13);
ghoppe