【问题标题】:Process result from places search google.api来自地点搜索 google.api 的处理结果
【发布时间】:2018-04-12 02:08:30
【问题描述】:

所以我目前正在开发一个 web 应用程序,我将不得不伪造我自己的 queryString 来搜索位置。我在 google places api 中发现了 Place Search 功能。但是,我似乎并不真正了解如何处理从查询中检索到的数据。

 var theUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&type=restaurant&keyword=cruise&key=myHiddenKey";

   $.get(theUrl, function(data, status){
    ...I dont seem to get any results here and I know by 
     definition that there are matches... 
     cause if you run the same query in the searchbar of the browser you get all the matches
   });

如果我想获取这些地点的所有名称和位置,我该怎么做?

非常感谢您的帮助

【问题讨论】:

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


    【解决方案1】:

    我从 javascript 运行该请求时出错:No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access.

    如果您想通过 javascript 使用 Places API,请使用 Google Maps Javascript API v3 Places Library

    【讨论】:

      猜你喜欢
      • 2012-12-30
      • 2016-11-10
      • 2013-12-31
      • 1970-01-01
      • 1970-01-01
      • 2015-03-04
      • 2018-07-26
      • 2019-11-15
      • 1970-01-01
      相关资源
      最近更新 更多