【发布时间】:2015-06-30 10:25:42
【问题描述】:
我正在尝试获取有关我在地图上显示的地点的更多信息,例如地点地址、电话号码等。您可以在此处查看我的代码:
http://jsfiddle.net/aboother/4q3jcg1s/
我做了一个'console_log(place)'如下:
function createMarker(place) {
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location
});
console.log(place);
var request = { reference: place.reference };
service.getDetails(request, function(details, status) {
google.maps.event.addListener(marker, 'click', function() {
console.log(place);
infowindow.setContent(place.name + "<br />" + place.vicinity);
infowindow.open(map, this);
});
});
}
但我看不到此对象中的地址或电话号码,即使我知道您可以获得此信息。我只能看到“附近”、“名称”等基本信息。有人可以帮忙吗?
【问题讨论】:
-
请编辑您的 jsfiddle。我们看不到日志,因为有资源错误。
-
小提琴有效,很快找到了解决方案。
标签: google-maps google-maps-api-3 google-places-api google-places