I am using a geocoder API which returns result in a callback
data = data ? data : {} // if not given initialize to empty
geocoder.geocode('Kathmandu, Nepal' , function(err, res) {
data.lat = res[0].latitude;
data.lng = res[0].longitude;
});
and using the data object
to construct a Geopoint
here = new GeoPoint(here); // data is still {} here
My question is how to use response from callback in above scenario?