This sample demonstrates how to use find to search for records in a map service, then display the results in an HTML table.
params = new FindParameters(); params.layerIds = ; params.searchFields = ["areaname"];
When you click the Find button, the function
doFind reads the input box and uses it as the search text. The find is then executed:
params.searchText = document.getElementById("searchText").value; find.find(findUrl, params).then(showResults).catch(rejectedPromise);
The results are returned as an array of FindResult objects. These are graphics, which have attributes that you can retrieve through syntax such as
result.feature.attributes.AREANAME. After find completes, the callback function showResults() loops through these features and constructs an HTML table from their attributes.