2012-07-31 79 views
0

我几乎不想制作应用程序,但我需要从foursquare取得场地,即时消息使用此代码,但它的奇怪,即时消息什么都没有。Fetch Foursquare场地API

<script> 
var latLong = '17.548065, -99.500868'; 
var url = 'https://api.foursquare.com/v2/venues/explore?ll=40.7,-74&radius=500&client_id=XXXX&client_secret=XXXX&v=20120731'; 
$.getJSON(url, function(json) { 
console.log(json); 
$("#results").html(json.response.groups.venue.name); 
}); 
</script> 

另外,如果你能帮助我做与谷歌Places API的同样的事情,我会非常感激。

https://developers.google.com/maps/documentation/places/?hl=es

此致敬礼!

回答

0

您需要改用JSONP

尝试追加?callback=?url

var url = 'https://api.foursquare.com/v2/venues/explore?ll=40.7,-74&radius=500&client_id=XXXX&client_secret=XXXX&v=20120731?callback=?'; 
+0

没有工作伙伴,Chrome开发者控制台现在显示“Unespected token” – Hector 2012-07-31 14:18:43