Select to view content in your preferred language

Begginer's Question: I can see the map on the js sandbox but not when I run the html

1995
11
Jump to solution
01-16-2013 11:55 AM
ionarawilson1
Deactivated User
I am following the tutorials on how to create a web map using javascript, however when I copy and paste this code from the sandbox to a blank document and save it as html (or I create an html on Aptana) on my computer, and I ran it, the browser is blank. Why is this happening?

This is the link to the tutorial:

http://help.arcgis.com/en/webapi/javascript/arcgis/jstutorials/#intro_agstemplate

Thank you!

And this is supposed to be a live version of the sample in the tutorial.
[HTML]
<!DOCTYPE html>
  <html>
  <head>
  <title>Create a Web Map</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">

  <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css">
  <style>
    html,body,#mapDiv,.map.container{
      padding:0;
      margin:0;
      height:100%;
    }
  </style>

  <script>var dojoConfig = { parseOnLoad:true };</script>
  <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3compact"></script>
  <script>
    dojo.require("esri.map");
    dojo.require("esri.arcgis.utils");

    var map;
 
    function init(){
      var webmapid = "1a40fa5cc1ab4569b79f45444d728067";
      esri.arcgis.utils.createMap(webmapid, "mapDiv").then(function(response){
        map = response.map;
      });
    }

    dojo.ready(init);
  </script>

  </head>

  <body>
    <div id="mapDiv"></div>
  </body>
  </html>
[/HTML]
0 Kudos
11 Replies
ionarawilson1
Deactivated User
Thank you Derek, I was still doing the tutorials, so I was not there yet, but thank you for pointing that.
0 Kudos
StephenLead
Honored Contributor
http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/#intro_devenvfirst line on the page, "When developing with the ArcGIS API for JavaScript, a web server is required."Easy to overlook? Yes. But it's documented. You'll encounter situations like this often.cheers.
Derek, I'm 100% certain that that passage wasn't there when this thread was started, cos I trawled the whole beginners sections looking for a link to include. Glad to see it's been added. Cheers,Steve
0 Kudos