在这里阅读了很多帖子(其中大部分都是与API v2相关的)并且仍然没有任何线索,我的谦虚请求:
我正在尝试从两个地理编码器调用中获取LatLng数据:
function geocoderMarkerA(fromValue) {
return geocoder.geocode( { 'address': fromValue}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var markerA = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
icon: 'red_MarkerA.png'
});
return results[0].geometry.location;
} else {
Ti.API.info("Geocode was not successful for the following reason: " + status);
}
});
}
function geocoderMarkerB(toValue) {
return geocoder.geocode( { 'address': toValue}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var markerA = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
icon: 'green_MarkerB.png'
});
return results[0].geometry.location;
} else {
Ti.API.info("Geocode was not successful for the following reason: " + status);
}
});
}
我尝试使用$ .when但我仍然无法获得两个返回的数据。我只想将结果作为两个变量或数组。 我提前感激不尽!