Skip to content

Instantly share code, notes, and snippets.

@mhkeller
Last active December 10, 2015 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhkeller/4505959 to your computer and use it in GitHub Desktop.
Save mhkeller/4505959 to your computer and use it in GitHub Desktop.
$.ajax call for MapQues Open Geocoding API
// An improved ajax call removing the callback parameter
$.ajax({
url:'http://open.mapquestapi.com/geocoding/v1/address?&inFormat=kvp&outFormat=json&location='+city+','+state,
dataType:'JSONP',
city:city,
state:state,
success: function(data){
console.log(y,this.city,this.state,data)
}
});
// This is the basic mapquest osm api call which doesn't work well. It causes numerous parse errors and mismatches results
$.ajax({
url:'http://open.mapquestapi.com/geocoding/v1/address?callback=renderOptions&inFormat=kvp&outFormat=json&location='+city+','+state,
dataType:'JSONP',
jsonpCallback: 'renderOptions'
}).done(function(data){
return data.results[0].locations[0].latLng
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment