AnsweredAssumed Answered

Can   xmlhttprequest and queryTask be used  in promise.all together?

Question asked by gisfinder on Oct 23, 2018
Latest reply on Oct 23, 2018 by rscheitlin

I have two async requests:

  1. ordinary rest request 
  2.  request arcigs map service using queryTask

Can "dojo/promise/all" support the promise.all to process the response after the above two responses returned? 

The above two rest services are all accessible for internet users.


My code is as below what I want.


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
<script src=""></script>
    require(['dojo/Deferred', 'dojo/promise/all',"esri/request", "esri/config", "esri/tasks/QueryTask","esri/tasks/query"], function(Deferred, all,esriRequest,esriConfig,QueryTask,Query) {
        // code to initate query tasks here
        var qURL = "";
        var queryTask  = new QueryTask(qURL); // ESRI query task
        var query  = new Query();
        query.returnGeometry = false;
        query.where = "STATE_NAME='California'";
        query.outFields = ["*"];
        var xhr = new XMLHttpRequest();  //xhr
        xhr.responseType = "json";
        var url = '';
        var deferredTask2=new Deferred();
        var deferredTask1 = new Deferred();'GET',url,true);
        xhr.onload=function(e) {
            if(xhr.readyState== 4) {
                deferredTask2.resolve(e);  // ????

        queryTask.execute(query );
        queryTask.on("complete", function(evt1) {

        all([deferredTask1deferredTask2]).then(function(results) {  //??
            var t=results;