Skip to content

Instantly share code, notes, and snippets.

@dbouwman
Last active September 6, 2018 18:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbouwman/5131087 to your computer and use it in GitHub Desktop.
Save dbouwman/5131087 to your computer and use it in GitHub Desktop.
Snipped showing geocoding w/ jquery and the Esri geocode service
geocodeAddress: function (data) {
console.log('Geocoder called with ' + data);
//although there is a dijit that can do this search
//it's just a simple ajax call, so we will just use jquery
var url = 'http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find';
this.layout.showSpinner();
$.ajax(url, {
data: {
text: data,
f: 'json',
outSR:102100,
maxlocations:6
},
dataType: 'json',
success: this.geocodeResultsHandler ,
error: this.geocodeError,
complete: this.geocodeComplete
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment