0

So I've just finished the tutorial to at least get a map on the screen, and it already isn't working. Can someone see what I'm missing?htmlfilejavascriptfile

3
  • 1
    how are you accessing your webmap? Are you just calling the C:\\path\to\app?
    – Craig
    Mar 8, 2014 at 0:49
  • 1
    I think you should edit your Question to include a link to the tutorial you are working through and use the Code formatting button to include the text (rather than image) of your code.
    – PolyGeo
    Mar 8, 2014 at 1:32
  • Here is a link to the tutorial. I don't have a web server yet, I need to design it before it goes online.
    – ottesen07
    Mar 10, 2014 at 22:33

2 Answers 2

1

attempting to load an external .js file in a script tag via file protocol is a problem

<script src="C:\Users\mottesen\Documents\Visual Studio 2013\Projects\SF_IM\SF_IM\My Project\SF_IM.js"></script>

try using either an http path or a relative path instead.

additionally, as noted in the help, loading your own application in the browser via http (as opposed to using file protocol) is mandatory as well.

https://developers.arcgis.com/javascript/jshelp/intro_devenv.html

1

You should probably scrap your local .js file, as John pointed out. Just write the code in the main HTML file. Since you're just starting out, you should try to get used to writing in the new AMD style since you're using the 3.8 API.

<script>
  var map;
  require(["esri/map", "dojo/parser", "dojo/domReady!"],
    function(esriMap, parser) {
      parser.parse();
      map = new esriMap("mapDiv", {
        center: [56.049, 38.485],
        zoom: 3,
        basemap: "streets"
      });
    }
  );
</script>
3
  • Is putting map in the global namespace really necessary?
    – blah238
    Mar 14, 2014 at 21:26
  • Probably not, but just about every ESRI sample does it.
    – Mintx
    Mar 14, 2014 at 21:37
  • @blah238 I put the map in the global namespace because I then do not need to define it in everyone of my widgets. Mar 17, 2014 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.