Identify features on a map API Code Sample

Discussion created by pdomja on Apr 20, 2012
Latest reply on Apr 30, 2012 by pdomja

I am just getting started with the Java API (and the java really). To gain a better understanding I have been pulling apart the Identify features on a map API sample.

I've been stuck for ages on one line of code to try and work out what is happening and what is being returned.

identifyTask.execute(identifyParams, function (idResults) { addToMap(idResults, evt); });

I understand that this is calling a the excute method of an identifyTask object in order to actually perform the identify, and the that identifyParams are the details of the query being performed.

The bit of code after in the optional callback argument confuses me, and is probably becasuse I'm a javascript novice.

It looks like a function is being defined here on the fly or something, but it dosent have a name and references idResults which isnt yet defined, then something goes on in some curly brackets.

Later in the code the addToMap function is called and using this idResults variable and referencing a length property. I know this is an object, but I am unsure of what class.

If anyone can shed any light on what is happening here, what class of object idResults is, and most importantly how the results of the search are being returned it would be a great help.

Kind regards,