I am attempting to evaluate a field and get a list of scores from address candidates when I use my address locator service. I receive no errors but it does not work as my console.log displays nothing.
Here is the code:
require(["esri/tasks/AddressCandidate",
"dojo/_base/array",
"esri/dijit/Search",
"esri/tasks/locator",
"dojo/on",
"dojo/dom",
"dojo/domReady!"], function (AddressCandidate, array, Search, Locator, on, dom) {
var locator = new Locator("http://maps.decaturil.gov/arcgis/rest/services/Public/WebAddressLocator/GeocodeServer");
on(dom.byId("btnTest"), "click", function () {
array.forEach(addressCandidates, function (candidate) {
if (candidate.score > score && candidate.attributes.Loc_name === document.getElementById("ownerAddress").value) {
stop = candidate;
score = candidate.score;
// Display the score on the console.
console.log(score);
}
});
});
});You can see that Find Address Candidates is part of the Geocode Service here: Find Address Candidates: (Public/WebAddressLocator)
What do I need to change in my code to make it work?
And I have my most recent version of my code here: csergent45/codeViolationNotice at dbfa38b4cc3c87f3153a6137aaa7529b9bceddeb · GitHub