Google maps 来自对google maps geocoder的两个异步调用的数据

Google maps 来自对google maps geocoder的两个异步调用的数据,google-maps,asynchronous,google-geocoder,Google Maps,Asynchronous,Google Geocoder,在阅读了这里的大量帖子(不幸的是,大多数帖子都与API v2相关)后,仍然没有得到任何线索,我谦虚的请求: 我正在尝试从两个地理编码器调用中获取LatLng数据: function geocoderMarkerA(fromValue) { return geocoder.geocode( { 'address': fromValue}, function(results, status) {

在阅读了这里的大量帖子(不幸的是,大多数帖子都与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,但仍然无法同时获取两个返回的数据。我只想将这两个结果作为两个变量或一个数组。
我非常感谢你

你得到了什么错误?我没有得到错误,数据是不确定的。你发布的链接的可能副本提供了答案。非常感谢。