I write a ajax to consume the arcGIS services to return json results, I have tried so many way for the findAddress function parameter, non seems work, plese help. Below is my code:
function AddrCandidates() { var obj = {}; obj.Street = $.trim($("[id*=txtStreet]").val()); obj.City = $.trim($("[id*=txtCity]").val()); obj.State = $.trim($("[id*=txtState]").val()); obj.Zip5 = $.trim($("[id*=txtZip5]").val()); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "http://something/arcgis/rest/services/GeocodingResources/USA_CompositeAll/GeocodeServer/findAddressCandidates", data: { data: {Address: "380 New York St", City: "Redlands", State: "CA", Zip: "92373"},}, // data: JSON.stringify(obj), datatyp: "json", success: function (data) { var results = data.d; var candidateAddr = results.candidates; alert(results); } else { alert("No address found"); } }, failure: function (xmlHttpRequest, status, err) { alert('Error happens: ' + err); } }); } The example usage address in document is: http://sampleserver1.arcgisonline.c...+York+Street&City=Redlands&State=CA&Zip=92373
Any help would be appreciated. Thank you
أكثر...
function AddrCandidates() { var obj = {}; obj.Street = $.trim($("[id*=txtStreet]").val()); obj.City = $.trim($("[id*=txtCity]").val()); obj.State = $.trim($("[id*=txtState]").val()); obj.Zip5 = $.trim($("[id*=txtZip5]").val()); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "http://something/arcgis/rest/services/GeocodingResources/USA_CompositeAll/GeocodeServer/findAddressCandidates", data: { data: {Address: "380 New York St", City: "Redlands", State: "CA", Zip: "92373"},}, // data: JSON.stringify(obj), datatyp: "json", success: function (data) { var results = data.d; var candidateAddr = results.candidates; alert(results); } else { alert("No address found"); } }, failure: function (xmlHttpRequest, status, err) { alert('Error happens: ' + err); } }); } The example usage address in document is: http://sampleserver1.arcgisonline.c...+York+Street&City=Redlands&State=CA&Zip=92373
Any help would be appreciated. Thank you
أكثر...