Skip to main content
edited tags
Link
Devdatta Tengshe
  • 41.6k
  • 35
  • 144
  • 263
added 119 characters in body
Source Link
George Silva
  • 6.3k
  • 3
  • 37
  • 71

I'm having some problems to get started using the ESRI JavaSript API. I have a test map service published on my notebook but I can't get it to display. I don't have problems with esri hosted services, just the ones I'm trying to host.

Here is some code:

<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1" type="text/javascript"></script>
<link href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css" rel="stylesheet" type="text/css" >
<script type="text/javascript">
    dojo.require("esri.map");
    dojo.require("esri.geometry");
    dojo.require("esri.layers");
    var map;
    function init() {
        esri.config.defaults.io.proxyUrl = "/proxy/proxy.ashx";
        map = new esri.Map("mapDiv");
        // var basemapURL = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
        var myURL = "http://brpnb010/arcgis/rest/services/teste/MapServer";

        // var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL);
        var myLayer = new esri.layers.ArcGISTiledMapServiceLayer(myURL);

        // map.addLayer(basemap);
        map.addLayer(myLayer);

        dojo.connect(map, "onExtentChange", showExtent);
    }

    function showExtent(extent) {
        var s = "";
        s = "XMin: " + extent.xmin +
        " YMin: " + extent.ymin +
        " XMax: " + extent.xmax +
        " YMax: " + extent.ymax;

        dojo.byId("onExtentChangeInfo").innerHTML = s;
    }
    
    dojo.addOnLoad(init);
</script>

I'm using Visual Studio to develop, and when the page loads, I get a "Could not load cross domain resources" error.

edit I'm using version 2.1 of the Javascript API. And I'm developing on localhost, which has the brpnb010 name.

Any ideas?

Thanks,

George

I'm having some problems to get started using the ESRI JavaSript API. I have a test map service published on my notebook but I can't get it to display. I don't have problems with esri hosted services, just the ones I'm trying to host.

Here is some code:

<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1" type="text/javascript"></script>
<link href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css" rel="stylesheet" type="text/css" >
<script type="text/javascript">
    dojo.require("esri.map");
    dojo.require("esri.geometry");
    dojo.require("esri.layers");
    var map;
    function init() {
        esri.config.defaults.io.proxyUrl = "/proxy/proxy.ashx";
        map = new esri.Map("mapDiv");
        // var basemapURL = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
        var myURL = "http://brpnb010/arcgis/rest/services/teste/MapServer";

        // var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL);
        var myLayer = new esri.layers.ArcGISTiledMapServiceLayer(myURL);

        // map.addLayer(basemap);
        map.addLayer(myLayer);

        dojo.connect(map, "onExtentChange", showExtent);
    }

    function showExtent(extent) {
        var s = "";
        s = "XMin: " + extent.xmin +
        " YMin: " + extent.ymin +
        " XMax: " + extent.xmax +
        " YMax: " + extent.ymax;

        dojo.byId("onExtentChangeInfo").innerHTML = s;
    }
    
    dojo.addOnLoad(init);
</script>

I'm using Visual Studio to develop, and when the page loads, I get a "Could not load cross domain resources" error.

Any ideas?

Thanks,

George

I'm having some problems to get started using the ESRI JavaSript API. I have a test map service published on my notebook but I can't get it to display. I don't have problems with esri hosted services, just the ones I'm trying to host.

Here is some code:

<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1" type="text/javascript"></script>
<link href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css" rel="stylesheet" type="text/css" >
<script type="text/javascript">
    dojo.require("esri.map");
    dojo.require("esri.geometry");
    dojo.require("esri.layers");
    var map;
    function init() {
        esri.config.defaults.io.proxyUrl = "/proxy/proxy.ashx";
        map = new esri.Map("mapDiv");
        // var basemapURL = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
        var myURL = "http://brpnb010/arcgis/rest/services/teste/MapServer";

        // var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL);
        var myLayer = new esri.layers.ArcGISTiledMapServiceLayer(myURL);

        // map.addLayer(basemap);
        map.addLayer(myLayer);

        dojo.connect(map, "onExtentChange", showExtent);
    }

    function showExtent(extent) {
        var s = "";
        s = "XMin: " + extent.xmin +
        " YMin: " + extent.ymin +
        " XMax: " + extent.xmax +
        " YMax: " + extent.ymax;

        dojo.byId("onExtentChangeInfo").innerHTML = s;
    }
    
    dojo.addOnLoad(init);
</script>

I'm using Visual Studio to develop, and when the page loads, I get a "Could not load cross domain resources" error.

edit I'm using version 2.1 of the Javascript API. And I'm developing on localhost, which has the brpnb010 name.

Any ideas?

Thanks,

George

Tweeted twitter.com/#!/StackGIS/status/26276304521265153
Source Link
George Silva
  • 6.3k
  • 3
  • 37
  • 71

Problems with ESRI JavaScript API

I'm having some problems to get started using the ESRI JavaSript API. I have a test map service published on my notebook but I can't get it to display. I don't have problems with esri hosted services, just the ones I'm trying to host.

Here is some code:

<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1" type="text/javascript"></script>
<link href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css" rel="stylesheet" type="text/css" >
<script type="text/javascript">
    dojo.require("esri.map");
    dojo.require("esri.geometry");
    dojo.require("esri.layers");
    var map;
    function init() {
        esri.config.defaults.io.proxyUrl = "/proxy/proxy.ashx";
        map = new esri.Map("mapDiv");
        // var basemapURL = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
        var myURL = "http://brpnb010/arcgis/rest/services/teste/MapServer";

        // var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL);
        var myLayer = new esri.layers.ArcGISTiledMapServiceLayer(myURL);

        // map.addLayer(basemap);
        map.addLayer(myLayer);

        dojo.connect(map, "onExtentChange", showExtent);
    }

    function showExtent(extent) {
        var s = "";
        s = "XMin: " + extent.xmin +
        " YMin: " + extent.ymin +
        " XMax: " + extent.xmax +
        " YMax: " + extent.ymax;

        dojo.byId("onExtentChangeInfo").innerHTML = s;
    }
    
    dojo.addOnLoad(init);
</script>

I'm using Visual Studio to develop, and when the page loads, I get a "Could not load cross domain resources" error.

Any ideas?

Thanks,

George