-1

I am working with dojo 1.10.

This is my main script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Title</title>
    <link rel="stylesheet" href="http://SERVERABC/arcgis_js_api/library/3.10/3.10/js/esri/css/esri.css"/>


    <style id="myStyle">


      html, body {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
        font-family: Arial, Calibri, Times New Roman;
      }
      textarea, input[type="text"]
      {
          font-family: Arial, Calibri, Times New Roman;
          font-size: 12px;
      }

    </style>

    <script type="text/javascript" src="js/common.js"></script>

    <script>
        dojoConfig = {
            packages: [
                { name: "js", location: "/js" }
            ]
        };
    </script>
    <script src="http://SERVERABC/arcgis_js_api/library/3.10/3.10/init.js" ></script>



    <script>
        var map;
        var streetMap;
        var imageryMap;

        require(["esri/map",
            "esri/config",
            "esri/layers/FeatureLayer",
            "esri/geometry/webMercatorUtils",
            "esri/geometry/Extent",
            "esri/layers/ArcGISTiledMapServiceLayer",
            "js/parameters",

            "dojo/fx",
            "dojo/window",
            "dojo/parser",
            "dojo/on",
            "dojo/dom",
            "dojo/dom-geometry",
            "dojo/domReady!"], function (Map, esriConfig, FeatureLayer, webMercatorUtils, Extent, ArcGISTiledMapServiceLayer, Parameters, coreFx, win, parser, on, dom, domGeom) {

                esriConfig.defaults.io.proxyUrl = "proxy.ashx";
                esriConfig.defaults.io.alwaysUseProxy = false;
                parser.parse();

                map = new Map("map", {
                    center: [114.220118, 22.317574], // longitude, latitude
                    zoom: 1,
                    showAttribution: false,
                    lods: [
                    //                        { "level": 6, "resolution": 2445.98490512499, "scale": 9244648.868618 },
                    //                        { "level": 7, "resolution": 1222.99245256249, "scale": 4622324.434309 },
                    //                        { "level": 8, "resolution": 611.49622628138, "scale": 2311162.217155 },
                    //                        { "level": 9, "resolution": 305.748113140558, "scale": 1155581.108577 },
                    //                        { "level": 10, "resolution": 152.874056570411, "scale": 577790.554289 },
                    //                        { "level": 11, "resolution": 76.4370282850732, "scale": 288895.277144 },
                    //                        { "level": 12, "resolution": 38.2185141425366, "scale": 144447.638572 },
                    //                        { "level": 13, "resolution": 19.1092570712683, "scale": 72223.819286 },
                        {"level": 14, "resolution": 9.55462853563415, "scale": 36111.909643 },
                        { "level": 15, "resolution": 4.77731426794937, "scale": 18055.954822 },
                        { "level": 16, "resolution": 2.38865713397468, "scale": 9027.977411 },
                        { "level": 17, "resolution": 1.1943285668550503, "scale": 4513.988705 },
                        { "level": 18, "resolution": 0.5971642835598172, "scale": 2256.994353 },
                        { "level": 19, "resolution": 0.29858214164761665, "scale": 1128.497176 }
                    ]
                });

                streetMap = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer", {
                    id: "streetMap"
                });
                imageryMap = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer", {
                    id: "imageryMap"
                });

                map.addLayer(streetMap);
                map.addLayer(imageryMap);
                imageryMap.hide();
                onlyForTesting();

                map.on("load", function () {

                    map.resize();
                });


            });
    </script>
</head>
<body>
    <div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'" style="width:100%; height:100%;">
        <div id="header" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">
            <div id="languagesContainer"></div>
        </div>
        <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" baseClass="dijitContentPaneNoPadding"></div>
    </div>
</body>
</html>

This HTML file should load another .js file called parameters.js that is located inside the js folder. The js folder and the HTML file is located in the same folder (same level).

It is working on a local computer. And I can create and get the object of the Parameter module that is loaded from js/parameters. But when I moved all the website files to the SERVERABC machine (inside wwwroot of IIS7) WIndows Server 2008 R2, the script will not run properly. It stops in the middle and does not show anything. It will only run properly if I delete the "js/parameters" inside the Require (and delete the "Parameters" variable too).

How can one script works on a computer but does not work on another? Is there any setting I must do first on the Server machine? Notice that all the Dojo javascript reference files are located in SERVERABC machine, either when I run my script on my local computer or from server SERVERABC.

Any ideas or solution will be much appreciated.

yugdablos
  • 33
  • 6

1 Answers1

1

I would try to load all scripts at once in one place right before the rest of the code. So we do. Have you checked the directory on the server if it has the same structure like your local computer?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
       <title>Title</title>
   <link rel="stylesheet" href="http://SERVERABC/arcgis_js_api/library/3.10/3.10/js/esri/css/esri.css"/>
   <script src="http://SERVERABC/arcgis_js_api/library/3.10/3.10/init.js" ></script>
   //load all necessary Scripts
    <script type="text/javascript" src="js/common.js"></script>
     ....and so on
MiBrock
  • 1,100
  • 1
  • 11
  • 22
  • 1
    My local computer is connected with the server network. So either on my local computer, or on the SERVERABC machine, I am using: But this is not a problem anymore now. I solved it by only changing 1 line of code. packages: [ { name: "js", location: "/js" } ] to packages: [ { name: "js", location: "htt p://SERVERABC/PROJFOLDER/js/" } ] – yugdablos Oct 03 '14 at 03:22