Hi
I try to execute a simple getLocations() fuction in the Google Map API
but the callback function is not working. It is little hard to find,
what I am missing here. I appreciate your help. javascript code:
var map = null;
var myAddress = new Array();
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
GDraggableObject.setDraggableCursor('default') //change
the cursor
map = new GMap2(document.getElementById("GgMap"));
map.addControl(new GMapTypeControl(1));
map.setCenter(new GLatLng(34.746481, -92.289595), 6);
map.setMapType(G_HYBRID_MAP);
map.addControl(new GSmallMapControl())
geocoder = new GClientGeocoder();
}
}
//Main GeoCoding address functions
function showAddress()
{
var location = "3401 Fair Park Blvd, Little Rock, AR";
if (geocoder) {
var result = null;
try
{
geocoder.getLocations(location, function(result) {
// If that was successful
if (result.Status.code == G_GEO_SUCCESS) {
if (result.Placemark.length > 0) {
var p =
result.Placemark[0].Point.coordinates;
alert(p.toString());
}
}
});
}
catch (err)
{
alert(err.toString());
}
}
}
<div id="GgMap" style="border: thin ridge; width: 450px; height:
350px"></div>
<input type="submit" value="Go!" onclick="showAddress();" />
Is there any good way to debug callback functiion on javascript?
Thanks,
KP
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" 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.