如何使用InfoWindow在google地图上显示电话、网址和URL的信息?

How to show the information for the telephone and the website and URL on google map by using InfoWindow?

使用下面的 google 地图 API 示例代码,我正在尝试制作我的 google 地图应用程序。但是,当我搜索餐厅并点击地图上的标记时,我看不到电话、网站的信息,也无法访问url。显示信息的解决方案是什么?

这是我参考的示例代码 https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-hotelsearch?hl=ja

这是我正在编写的代码。 https://github.com/takeyan1004/javascript-application/blob/master/grf1218.html

方法 textSearch() 的响应没有电话、网站或某个地方的 url,您需要对 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);
  });