javascript - placeId 无法用作地点详细信息搜索的请求参数

标签 javascript google-maps-api-3 google-places-api

我知道他们只是弃用了 id 和引用,并且我通过初始搜索获得了有效的 placeId - 但由于某种原因,当我去搜索这样的详细信息时:

function(place_id){

    var request = {
        placeId: place_id
    }

    this.service.getDetails(request, function(data){
        //Da callback
    });
}

我收到一个错误,要求提供已弃用的字段“reference”:

Uncaught Error: Missing parameter. You must specify reference.

感谢您的帮助!

最佳答案

这取决于所使用的 API 版本。

当前发布版本是 3.16,您必须使用那里的引用

从 3.17 开始,您可以(并且应该)使用 placeId

关于javascript - placeId 无法用作地点详细信息搜索的请求参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25416318/

相关文章:

javascript - 使用 JavaScript 在页面上搜索文本

javascript - jquery.width 在图像上返回 0

javascript - geocoder.geocode() 如何工作?

android - 谷歌地方 API : Are "place_id" or "id" unique to any city in the world?

google-maps - Google Places API 结果与 Google map 不匹配

android - 在 Android 中查找位置类型

javascript - 编辑 D3 Sunburst 可视化的 innerRadius

javascript - 如何将 URL 动态添加到 javascript 中,以使第二页的 div 显示在第一页上?

javascript - 谷歌地图 API V3 : getBounds() convert result for fitBounds()

javascript - 无效值错误: setIcon: in property rotation: not a number