var items, markers_data = [];
$.getJSON('https://api.foursquare.com/v2/venues/search?near=London&categoryId=4bf58dd8d48988d14c941735&client_id=BOCHQZ4NF0D2NNFP2HM0INIKPUESPUX3RMRDUX02MPWIYSM2&client_secret=EDNX150PKLS4SMRHWL21Q0KLBAQXYQUQV5RAZI0HZSA1IYGG&v=20161111',
$.each(data.response.venues, function (i, venues) {
content = '<p>Name: ' + venues.name +
' Address: ' + venues.location.address +
' Lat/long: ' + venues.location.lat + ', ' + venues.location.lng + '</p>';
$(content).appendTo("#venues");
lat: venues.location.lat,
lng: venues.location.lng,
size: new google.maps.Size(32, 32),
url: 'https://foursquare.com/img/categories/food/default.png'
content: '<p>' + content + '</p>'
map.addMarkers(markers_data);
function printResults(data) {
$('#foursquare-results').text(JSON.stringify(data));
$(document).on('click', '.pan-to-marker', function (e) {
var position, lat, lng, $index;
$index = $(this).data('marker-index');
position = map.markers[$index].getPosition();
$(document).ready(function () {
getTileUrl: function(coord, zoom) {
return "http://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
tileSize: new google.maps.Size(256, 256),
map.on('marker_added', function (marker) {
var index = map.markers.indexOf(marker);
$('#results').append('<li><a href="#" class="pan-to-marker" data-marker-index="' + index + '">' + marker.title + '</a></li>');
if (index == map.markers.length - 1) {
var xhr = $.getJSON('https://api.foursquare.com/v2/venues/search?near=London&categoryId=4bf58dd8d48988d14c941735&client_id=BOCHQZ4NF0D2NNFP2HM0INIKPUESPUX3RMRDUX02MPWIYSM2&client_secret=EDNX150PKLS4SMRHWL21Q0KLBAQXYQUQV5RAZI0HZSA1IYGG&v=20161111');