使用谷歌地图API的示例代码,如下所示,我正在尝试制作我的谷歌地图应用程序。但是,当我搜索餐厅并点击地图上的标记时,我看不到电话,网站的信息,也无法访问网址。显示信息的解决方案是什么?
以下是我提到的示例代码 https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-hotelsearch?hl=ja
这是我写的代码。 https://github.com/takeyan1004/javascript-application/blob/master/grf1218.html
答案 0 :(得分:0)
方法textSearch()的响应没有地方的电话,网站或网址,你需要对getDetails(place_id)进行其他调用来获取该数据。
示例:
var places = new google.maps.places.PlacesService(map);
places.getDetails({placeId: marker.placeResult.place_id},
function(place, status) {
if (status !== google.maps.places.PlacesServiceStatus.OK) {
return;
}
infoWindow.open(map, marker);
//place object has the information about phone, webste...
buildIWContent(place);
});