Skip to content

Instantly share code, notes, and snippets.

@erinpagemd
Created May 31, 2014 21:52
Show Gist options
  • Save erinpagemd/6dff1330bdef2b686af0 to your computer and use it in GitHub Desktop.
Save erinpagemd/6dff1330bdef2b686af0 to your computer and use it in GitHub Desktop.
/*jshint camelcase:false */
/* global loc */
(function(){
'use strict';
$(document).ready(initialize);
function initialize(){
$('#get-food').on('click', getFoodData);
}
//build query for Yelp
function getFoodData(){
var str1 = 'http://api.yelp.com/business_review_search?term=yelp&lat=';
var str2 = loc.lat;
var str3 = '&long=';
var str4 = loc.lng;
var str5 = '&radius=25&limit=5&ywsid=EJDoFH3OEMV8iJKwE3pfag&category=restaurants&callback=?';
var url = str1.concat(str2,str3, str4, str5);
console.log(url);
$.getJSON(url, receive);
}
function receive(data){
console.log(data);
//data.forEach(plotOnMap);
}
// function plotOnMap(data){
// window.addMarker(data.mapped_location.latitude, data.mapped_location.longitude, data.title);
// }
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment