Last active
December 10, 2015 22:58
-
-
Save mhkeller/4505959 to your computer and use it in GitHub Desktop.
$.ajax call for MapQues Open Geocoding API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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