Javascript 向谷歌地图api发送请求
当我得到坐标时,我需要发送如下请求:Javascript 向谷歌地图api发送请求,javascript,google-maps,google-maps-api-3,Javascript,Google Maps,Google Maps Api 3,当我得到坐标时,我需要发送如下请求: http://maps.googleapis.com/maps/api/geocode/json?latlng=55.75320193022759,37.61922086773683&sensor=false&language=ru ,但我如何用JavaScript发送此信息?如果您使用的是Google Maps API v3,请使用地理编码服务 var geocoder = new google.maps.Geocoder(); var
http://maps.googleapis.com/maps/api/geocode/json?latlng=55.75320193022759,37.61922086773683&sensor=false&language=ru
,但我如何用JavaScript发送此信息?如果您使用的是Google Maps API v3,请使用地理编码服务
var geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(55.75320193022759, 37.61922086773683);
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
alert(results[1].formatted_address);
} else {
alert("Geocoder failed due to: " + status);
}
});
见: