0
我试图从JSON中的Google Places API检索地点列表。我正在发送一个AJAX请求。来自Google Places API的AJAX请求返回null
GET请求发送正确的参数并收到200 OK成功消息,但没有响应(每萤火虫)。
你知道我如何检索JSON中的位置列表或将JSONP转换为JSON吗?
photos.js
$.ajax({
type: 'GET',
url:'https://maps.googleapis.com/maps/api/place/search/json',
dataType: 'json',
data: {
'location' : data.location.latitude+","+data.location.longitude,
'radius' : 500,
'key' : "mykeyhere",
'sensor' : "false",
'keyword' : "hotel"
},
success: function(hotel){
console.log(hotel);
}
});
我试图改变数据类型设置为JSONP,我能得到与所有房源的响应,但我得到"html_attributions" : []
错误,因为它期待JSON.The反应是描述在https://developers.google.com/places/documentation/search,但我得到一个不识别的萤火虫错误html_attributions
您是否尝试过使用[商家信息库(https://developers.google.com/maps/documentation/ javascript /地方)的谷歌地图JavaScript API V3呢? –
我有同样的问题:( 这是我的问题http://stackoverflow.com/questions/12660723/search-in-google-places-via-ajax-gives-empty-results-but-not-in-浏览器 –