I am developing an HTML+JavaScript application for Android OS. In the HTML page I am loading another JS file which has this code:
var Map = {}; $.getScript("cordova-2.6.0.js",function(){ Map['x'] = somthin } At the HTML page I am looping through the map. The problem is that, at the first time my application is loading, everything works well. But when I am openning other appliaction or just going back and then I am resuming my application the length of the map is equal to zero. (I think it relates to the order that the HTML page loads its dependencies, but I dont know how to solve this problem....)
Any suggestions? Thanks!
EDIT
My JS code in My JSFile.js:
var Map = {}; $.getScript("cordova-2.6.0.js",function(){ Map['X'] = 'hi'; }); My JS code in the HTML page:
<head> <script src="JSFile.js"></script> </head> <body> $(document).ready(function(){ for(var i in Map) { alert(Map[i]); } }); </body> The actual result is that in the first time the appliaction is loading, everything is working well - I am geting an alert "hi". But when the application is resuming - I am getting nothing.
Map['x'] = somthg, thenlengthalways be zero