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?
-
1how are you accessing your webmap? Are you just calling the C:\\path\to\app?– CraigMar 8, 2014 at 0:49
-
1I 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.– ottesen07Mar 10, 2014 at 22:33
2 Answers
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
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>
-
-
-
@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