AnsweredAssumed Answered

QueryTask results not loading after refresh

Question asked by Jenn_88 on Nov 25, 2014
Latest reply on Nov 25, 2014 by Jenn_88



I have a QueryTask script and it only works the first time in a given browser or computer (it worked once in Firefox, Chrome and IE on work computer, and once in Firefox on my home computer). Now, whenever I refresh or access the page again the results don't show. I don't have this problem if I return the results as text; I can refresh as many times as I want and it works fine. Yep, I've restarted and cleared caches! It's my first time trying to build a web map with querying functionality so I might be missing something really obvious... Please let me know if I need to explain something better, too! Thanks a bunch!


 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
 <title>CRM Project Creator</title>
 <!--<link rel="stylesheet" type="text/css" href="style.css">--> 
 <link rel="stylesheet" href=""> 
 <script src=""></script>

 var map;
 var symbol;
  "esri/tasks/query", "esri/tasks/QueryTask",
  "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/Color",

   ], function (
  Map, ArcGISDynamicMapServiceLayer,
  Query, QueryTask, SimpleFillSymbol, SimpleLineSymbol,
  Color) {

  map = new Map("map", { 
   basemap: "streets",
   center: [-122.86, 49.1],
   zoom: 10

  // query code
  var query = new Query();
  var queryTask = new QueryTask("http://[redacted]/MapServer/50");
  query.where = "Project_Number LIKE '%00%'";
  query.returnGeometry = true;
  query.outFields = ["*"];
  //query.outSpatialReference = new esri.SpatialReference({wkid : 4326});
  queryTask.execute(query, showResults);

  symbol = new SimpleFillSymbol();
  symbol.setColor(new Color([255,0,255,1]));

  function showResults(results) {;
   var resultFeatures = results.features;
   for (i=0, il=resultFeatures.length; i<il; i++) {
    var graphic = resultFeatures[i];
   // set the extents of the query results 
   var extent = esri.graphicsExtent(results.features);




 <div id="map" style="width:1280px;height:860px"></div>