Embedding an ArcGIS Server 10 Mapping Application in a Website using Javascript API

1549
1
05-07-2013 01:51 PM
KristinMeseck1
New Contributor II
Hi,

So I didn't think it would be so difficult to find an answer to this, but after pouring through all of the samples on the ArcGIS API for JavaScript I still haven't found what I need. My problem is that I created and uploaded a map to ArcGIS Server 10 and created an application from that web service. I have the URL for that application and simply want to embed this application in my website. I was told Javascript API could do this, but all I'm getting out of the samples is how to build a map from scratch using the different widgets and dojos. The map service that I created can already do everything that I want it to do, all I need to do is embed the service in a web page. I tried the code below, which is essentially the code from the "add a world streetmap" sample, but I can't find where to add in my URL link to the mapping application. Also, I did see this video: http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/videos/sample_using.htm, and tried the code, (which incidentally does have a place to add the URL) but it didn't work (too old maybe?). I would greatly appreciate any advice on this. Thanks so much! -Kristin

<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
   <!-- The viewport meta tag is used to improve the presentation and behavior of the samples
     on iOS devices -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
   <title>World Street Map</title>

  <!-- <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/dojo/dijit/themes/claro/claro.css"> -->
   <link rel="stylesheet"
href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/esri/css/esri.css">
   <style>
       html, body, #map {
           padding: 0;
           margin: 0;
           height: 90%;
           width: 80%;
       }
   </style>

   <script>var dojoConfig = { parseOnLoad: true };</script>
   <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/"></script>

</head>

<body class="claro">
   <div id="map">
   <script>
       dojo.require("esri.map");
       var map;dojo.ready(function () {
           map = new esri.Map("map", {
                               basemap: "http://cezanne/Group1/Default.aspx",
               center: [-117.100, 32.700],
               zoom: 11
                               });
//<!-- Our Map link -->
           var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://cezanne/Group1/Default.aspx");
           map.addLayer(tiledMapServiceLayer);

       });
   </script>
</div>
</body>
</html>
0 Kudos
1 Reply
nicogis
MVP Frequent Contributor
your url rest service is http(s)://yourhost/yourinstanceags(default arcgis)/rest/services/(nameofservice or youragsfolder/nameofservice)/MapServer

for example: http://www.example.com/arcgis/rest/services/ExampleService/MapServer

var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer(http://www.example.com/arcgis/rest/services/ExampleService/MapServer);

see http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/ags_rest.html
0 Kudos