AnsweredAssumed Answered

How to use queryTask callback function

Question asked by zhouleizhou on Sep 27, 2016
Latest reply on Sep 29, 2016 by rscheitlin

When I use queryTask to call a function, say, function showResults() as below:

queryTask.execute(query, showResults);

 

function showResults (results) { ….}

 

One thing I am confused is that: usually when a function is called, the parameter that the function is going to use (e.g., results in this case) should be included inside the showResults().  Since queryTask called this function, it should be:

 queryTask.execute(query, showResults(ABC); then this ABC will be passed into function showResults.

 

In the above example, there is nothing like showResults(ABC), just showResults.  How can the function showResults (results) tell what kind of parameter is actually passed into it? Thanks!

Outcomes