[GIS] TypeError: g.join is not a function in queryTask.execute

arcgis-javascript-api

I need to query data from a server, so I try to exploit "Query data without a map" sample. However, at queryTask.execute I get following error:

TypeError: g.join is not a function

My code is similar to that in the example:

var queryTask = new QueryTask(featureClassUrl);

var query = new Query();
query.f = "json";
query.outFields = "*";
query.returnGeometry = true;
query.where = "Foo = 'Bar'";

$(document).submit(function (e) {
    queryTask.execute(query, updateResults);
});

function updateResults(results) {
    //working with the results
}

The only significant difference from the example is in the event listener. Does JQuery or submit event really break it?

The closest to my question what I found is on StackOverflow, but I failed to apply the solution for on to queryTask.execute.

I use JavaScript API v. 3.14.

Best Answer

query.outFields must be an array of strings, so you should rewrite that line to be:

query.outFields = ["*"];
Related Question