Error: scriptError The resource from this URL is not text: http://js.arcgis.com/3.8.

1874
4
03-28-2014 11:05 AM
MattTenold
New Contributor III
I can't figure out why I am getting this error that the JS 3.8 URL is not text.

[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Cluster Layer</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css">
    <style>
      html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
    </style>
<script src="http://js.arcgis.com/3.8/"></script>
    <script type="text/javascript">var djConfig = {parseOnLoad: true};</script>
   
<!--script data-dojo-config="async: true" src="//ajax.googleapis.com/ajax/libs/dojo/1.9.3/dojo/dojo.js"></script>
    <!--Include cluster layer -->
    <!--script type="text/javascript" src="http://localhost/lele3p.layers.ClusterLayer_new.js"></script-->

    <script type="text/javascript">
      //dojo.require("dijit.layout.BorderContainer");
      //dojo.require("dijit.layout.ContentPane");
      //dojo.require("esri.map");
      //dojo.require("esri.layers.graphics");
  
   require(["//inetpub/wwwroot/lele3p.layers.ClusterLayer_new"], function(ClusterLayer){
  
      var map;

      function init() {
        basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer");
        map = new esri.Map("map");

        map.addLayer(basemap);

        //resize the map when the browser resizes - view the 'Resizing and repositioning the map' section in
        //the following help topic for more details http://help.esri.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_guidelines.htm
        var resizeTimer;
        dojo.connect(map, 'onLoad', function(theMap) {
          dojo.connect(dijit.byId('map'), 'resize', function() {  //resize the map if the div is resized
            clearTimeout(resizeTimer);
            resizeTimer = setTimeout( function() {
              map.resize();
              map.reposition();
            }, 500);
          });
        });

        runQuery();
      }

  function runQuery() {

   var queryTask = new esri.tasks.QueryTask("http://gis.phila.gov/ArcGIS/rest/services/PhilaGov/Police_Incidents/MapServer/0");

   var query = new esri.tasks.Query();
   query.returnGeometry = true;
   query.where = '1=1';
   query.outFields = ["*"];

   dojo.connect(queryTask, "onComplete", function(featureSet) {

    var cL = new ClusterLayer({
     displayOnPan: false,
     map: map,
     features: featureSet.features,
     infoWindow: {
      template: new esri.InfoTemplate("${Sector}"),
      width: 325,
      height: 85
     },
     flareLimit: 15,
     flareDistanceFromCenter: 20
       });

             map.addLayer(cL);

   });

   dojo.connect(queryTask, "onError", function(err) {
    alert(err.details);
   });

   queryTask.execute(query);
  }

      dojo.addOnLoad(init);
   });
    </script>
  </head>

  <body class="tundra">
    <div dojotype="dijit.layout.BorderContainer" design="headline" gutters="false"
    style="width: 100%; height: 100%; margin: 0;">
      <div id="map" dojotype="dijit.layout.ContentPane" region="center" style="overflow:hidden;">
      </div>
    </div>
  </body>

</html>[/HTML]
0 Kudos
4 Replies
JeffPace
MVP Alum
you dont have any requires? they are all commented out
0 Kudos
JonathanUihlein
Esri Regular Contributor
Hi Matt,

It looks like you're using both legacy and AMD style DOJO. You should really try to write everything in AMD style syntax.

Aside from that, the issue comes from the following line:

require(["//inetpub/wwwroot/lele3p.layers.ClusterLayer_new"], function(ClusterLayer){    //...
});


This is the incorrect way to load a specific module.
DOJO's documentation should have more information on this.
0 Kudos
MattTenold
New Contributor III
The problem is I can't find good documentation on DOJO's website about AMD when used with ESRI JS API.   Can someone tell me how to correct this issue?
0 Kudos
JeffPace
MVP Alum
you will have more luck looking at the AMD samples on the esri forums
0 Kudos