Here's another attempt at a jsfiddle that should work: http://jsfiddle.net/99vD9/5/var elevationServiceUrl = "http://sampleserver4.arcgisonline.com/ArcGIS/rest/services/Elevation/ESRI_Elevation_World/MapServer/exts/ElevationsSOE/ElevationLayers/1/GetElevationAtLonLat"
dojo.connect(map, 'onClick', function (evt) {
esri.request({
url: elevationServiceUrl,
content: {
lon: evt.mapPoint.getLongitude(),
lat: evt.mapPoint.getLatitude(),
f: "json"
},
callbackParamName: "callback",
}).then(function (response, io) {
alert("Elevation = " + response.elevation.toFixed(1) + " meters");
}, function (error, io) {
console.error("Unable to get elevation", error);
alert("Unable to get elevation...");
});
});