Select to view content in your preferred language

Error ArcGIS API for Javascript v3.1

4036
24
Jump to solution
09-24-2012 12:17 AM
KristianLucido
Emerging Contributor
Hi,
i have a big problem with the new Api for Javascript. :confused: In my web app i have the version 2.7 and run correctly.
When i upgrade my webapp at version 3.1 i have this problem. I did the correct installation of the API.
Put the Api in a local webserver and change the configuration of "init.js" and "dojo.js" with correct parameters.
But this is the result:
[ATTACH=CONFIG]17910[/ATTACH]

Thanks in advance for the answer! 😉
0 Kudos
24 Replies
KristianLucido
Emerging Contributor
....and where is your application (web page) relative to the API?


C:\xampp\htdocs\<name of webapp>
0 Kudos
DavideLimosani
Frequent Contributor
Just to be sure...

those errors are very similar to mine when I call a page with api > 3.0 with the phisycal path "file:///C:/inetpub/wwwroot/test.html" instead of "localhost/test.html".

Are you calling your page in the proper way, right? In this case, are esri samples working on your webserver?
0 Kudos
__Rich_
Deactivated User
I hope we don't need to know about physical paths, only about the virtual paths provided by the web server.  (otherwise Davide is probably going to be correct! 😉 )

In the <script> element where you reference the API what have you got in the src attribute?
0 Kudos
KristianLucido
Emerging Contributor
Just to be sure...

those errors are very similar to mine when I call a page with api > 3.0 with the phisycal path "file:///C:/inetpub/wwwroot/test.html" instead of "localhost/test.html".

Are you calling your page in the proper way, right? In this case, are esri samples working on your webserver?


Yes is very similar...but i call my web page with the correct url:

localhost/<name of web app>
or
192.168.13.56/<name of web app>

The esri samlpes run correctly. I use the sample in the installation guide and run!

What's the configuration for dojoConfig?

This is the code for include the API

<script type="text/javascript" src="http://192.168.13.56/arcgis_js_api/library/3.1/jsapi"></script>
0 Kudos
__Rich_
Deactivated User
Save the attached file (localapitest.htm) to the root of your site, in your case that appears to be C:\xampp\htdocs\

The click this link:

http://localhost/localapitest.htm

(it's just the sample file from the API zip)

What do you see?

(need to zip attachement to upload)
0 Kudos
KristianLucido
Emerging Contributor
Save the attached file (localapitest.htm) to the root of your site, in your case that appears to be C:\xampp\htdocs\

The click this link:

http://localhost/localapitest.htm

(it's just the sample file from the API zip)

What do you see?

(need to zip attachement to upload)


I don't have this file in my zip Api.

But i try the example in the installation guide. this is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title>Simple Map</title>

    <link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.1/jsapi/js/dojo/dijit/themes/tundra/tundra.css">

    <script type="text/javascript" src="http://localhost/arcgis_js_api/library/3.1/jsapi/"></script>

    <script type="text/javascript">

      dojo.require("esri.map");

      function init() {

        var myMap = new esri.Map("mapDiv");

        //note that if you do not have public Internet access then you will need to point this url to your own locally accessible cached service.

        var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer");

        myMap.addLayer(myTiledMapServiceLayer);

      }

      dojo.addOnLoad(init);

    </script>

  </head>

  <body class="tundra">

    <div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"></div>

  </body>

</html>

and see this :

[ATTACH=CONFIG]17912[/ATTACH]

I have the same result with your file localapitest.htm
0 Kudos
__Rich_
Deactivated User
They are the same file, in the one I attached I had hard-coded the paths to the API based on your previous responses to make sure I understood the location of your API installation.

Can you post one of your files that doesn't work?
0 Kudos
__Rich_
Deactivated User

and in the configuration i put this url:

localhost/arcgis_js_api/library/3.1/jsapi/js/dojo/dojo
or
192.168.13.56/arcgis_js_api/library/3.1/jsapi/js/dojo/dojo


Where exactly did you put this?
0 Kudos
KristianLucido
Emerging Contributor
Thanks so much for the help 😉

Sorry but i can't post my file. Is a big web app and i work for important project and i can't post my file.

I follow the instruction for put the correct url. Subscribe [HOSTNAME_AND_PATH_TO_JSAPI] with the url. But the problem isn't the configuration in Api file because the example work good!
I don't understand :confused:
I'm going crazy :mad:
0 Kudos
__Rich_
Deactivated User
...and your app is definitely referencing the API the same way?

Just humour me, put this in your application page before the script element used to load the API:

<script type="text/javascript">     var dojoConfig = {         baseUrl:"http://localhost/arcgis_js_api/library/3.1/jsapi/js/dojo/dojo/"     }; </script>
0 Kudos