Javascript 当从另一个函数调用reverseGeocode时,它不会返回回调用。

Javascript 当从另一个函数调用reverseGeocode时,它不会返回回调用。,javascript,node.js,Javascript,Node.js,我有一个函数可以从GoogleAPI的reverseGeocode函数中获取位置详细信息,如下所示 var getLocationDetails=函数(回调,latLng){ log(“使用Google API获取位置详细信息”+latLng.lat+latLng.lng); var locationDetails={}; googleMapsClient.reverseGeocode({ latlng:[parseFloat(latlng.lat),parseFloat(latlng.lng

我有一个函数可以从GoogleAPI的reverseGeocode函数中获取位置详细信息,如下所示

var getLocationDetails=函数(回调,latLng){
log(“使用Google API获取位置详细信息”+latLng.lat+latLng.lng);
var locationDetails={};
googleMapsClient.reverseGeocode({
latlng:[parseFloat(latlng.lat),parseFloat(latlng.lng)]
},函数(错误,响应){
如果(!err){
locationDetails.address=response.json.results[0]。格式化的\u地址;
locationDetails.locality=response.json.results[1]。地址\组件[2]。长\名称;
locationDetails.area=response.json.results[1]。地址\组件[3]。长\名称;
locationDetails.state=response.json.results[1]。地址\组件[4]。长\名称;
locationDetails.country=response.json.results[1]。地址\组件[5]。长\名称;
locationDetails.zipCode=response.json.results[1]。地址\组件[6]。长\名称;
log(“获取的位置为”+locationDetails.address);
回调(错误、位置详细信息);
}否则{
回调(错误、位置详细信息);
}
});
控制台日志(“诸如此类”);
};