Summary
In this chapter we introduced the concept of tasks in ArcGIS Server. ArcGIS Server provides a number of tasks for commonly used operations in a web mapping application, such as attribute and spatial queries.
To execute a query, you need a QueryTask object that references a layer within a map service that you will execute the query against. You also need a Query object to define the query itself.
Properties you might choose to set on the Query object include where and text properties to define attribute queries, a geometry property to define a spatial query, and an outFields property to subset the fields that should be returned.
When the ArcGIS Server has finished processing the query, it returns a FeatureSet object to your application by way of a callback function. You specify the name of this function when you execute the query.
The callback function is responsible for processing the FeatureSet and the array of Graphic objects it stores in its feature property, on the map.
In the next...