I'm trying to write a simple JS function that gets some info from the Google Maps places API. I wrote this function:
function makeCall(url) {
var data = $.ajax({
type: "GET",
url: url,
async: false
});
return data
}
An example URL that I am passing is this (with the key removed) https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=37.7746031,-122.654422&rankby=distance&opennow=true&name=REI&key=API_KEY
This works fine locally, but I keep getting the cross domain request error when I try it on my server. I've tried just about everything, jsonp, requestJSON, a proxy, and I can't seem to get it to work. Is there a better way to do this?
Thanks.