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

asked Mar 7, 2014 at 23:33
3
  • 1
    how are you accessing your webmap? Are you just calling the C:\\path\to\app? Commented 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. Commented 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. Commented 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

answered Mar 14, 2014 at 20:45
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>
answered Mar 14, 2014 at 21:05
3
  • Is putting map in the global namespace really necessary? Commented Mar 14, 2014 at 21:26
  • Probably not, but just about every ESRI sample does it. Commented 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. Commented Mar 17, 2014 at 14:32

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.