Select to view content in your preferred language

Error ArcGIS API for Javascript v3.1

4053
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 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>


Thankssssssss. I resolve my problem with this code 😄
Thanks so much for the help!! Now my web app work correctly.

But why in Api < 3.0 this code is not necessary? And in the documentation isn't specified!
In the localapitest.htm there isn't this code but work good! I don't understand.....but i'm happy 😉
0 Kudos
__Rich_
Deactivated User
You're welcome...but it's not the complete answer.  (and I was delaying posting it in the hope of finding the real cause - tricky to do remotely though!)

The 'official' method should work although I think this way's better for most people and it's much simpler to explain!

With the current value i.e.localhost, it will only work when the app is being accessed from the same machine on which the API resides so you either need to change the value "localhost" to be either the IP or the hostname used to access the website or if all the apps are on the same site as the API you could use a relative URL.

I urge you to investigate and gain a full understanding of how URLs and paths are used in Dojo and don't accept a quick answer just because it works.

Please ask if you have any further questions.

(something is not right with the way that the baseUrl is being calculated in your apps, you really should find out why)
0 Kudos
KristianLucido
Emerging Contributor
You're welcome...but it's not the complete answer.  (and I was delaying posting it in the hope of finding the real cause - tricky to do remotely though!)

The 'official' method should work although I think this way's better for most people and it's much simpler to explain!

With the current value i.e.localhost, it will only work when the app is being accessed from the same machine on which the API resides so you either need to change the value "localhost" to be either the IP or the hostname used to access the website or if all the apps are on the same site as the API you could use a relative URL.

I urge you to investigate and gain a full understanding of how URLs and paths are used in Dojo and don't accept a quick answer just because it works.

Please ask if you have any further questions.

(something is not right with the way that the baseUrl is being calculated in your apps, you really should find out why)


I identify the problem. I search baseUrl in my webapp and found this code:
   djConfig = {
    parseOnLoad:true,
    baseUrl: "./",
    isDebug:false,
    locale: "it",
    modulePaths: { "dijits": "./dijits" }
   };
I search dojo.config and not djConfig for this i don't found. I have commented the part of baseUrl and the webapp run correctly.

Thanks so much 😄
This is the correct answer 😄
0 Kudos
__Rich_
Deactivated User
I identify the problem. I search baseUrl in my webapp and found this code:
   djConfig = {
    parseOnLoad:true,
    baseUrl: "./",
    isDebug:false,
    locale: "it",
    modulePaths: { "dijits": "./dijits" }
   };
I search dojo.config and not djConfig for this i don't found. I have commented the part of baseUrl and the webapp run correctly.

Thanks so much 😄
This is the correct answer 😄

Ah, so I was correct earlier:

Please show us the path you have used to the JS API and also what you've got in your dojoConfig etc.

The base URL being used to retrieve resources is incorrect, we just need to work out why.

...and exactly what have you set in your dojoConfig?


Please mark whichever post you think is correct as the 'answer'.

Told you it was worth investigating the 'real' cause, much more satisfying than simply pasting someone else's code, don't you agree? 🙂
0 Kudos
KristianLucido
Emerging Contributor
Ah, so I was correct earlier:




Please mark whichever post you think is correct as the 'answer'.

Told you it was worth investigating the 'real' cause, much more satisfying than simply pasting someone else's code, don't you agree? 🙂



Yes, of course 😄 without your help i never found the real cause of the problem.
Now i delete the declaration of the baseUrl in djConfig:

djConfig = {
    parseOnLoad:true,
    isDebug:false,
    locale: "it",
    modulePaths: { "dijits": "./dijits" }
   };

Now my web app run correctly....with API 3.1 😄

Thanks for the big help....have a good day!
:cool:
0 Kudos