Jump to content


  • Posts

  • Joined

  • Last visited

wychegnome's Achievements


Newbie (1/7)



  1. At least I think it is a timing issue but I could be wrong. I have a web page that loads an Ordnance Survey (UK) map into a window and then needs to add a series of overlays containing my own data. The overlays do not always load with one or all 'missing' when the page is loaded. The situation is worsened when the page is refreshed. And which overlay file(s) is missed seems to vary randomly. <body onLoad="initialiseMap()"> triggers the sequence and the following code forms a part of that sequence: $(document).ready(function(){ var commonOneFile = myMapPath + "common1.js"; var venueFile = myMapPath + "venues.js"; $.getScript(commonOneFile, function() { }); $.getScript(venueFile, function() { });// and load selective markers and lines if we have a file name to work from if (myFileName.length > 2) { var commonTwoFile = myMapPath + "common2.js"; var linesFile = myMapPath + myFileName + "lines.js"; var markersFile = myMapPath + myFileName + "markers.js"; $.getScript(commonTwoFile, function() { }); $.getScript(linesFile, function() { }); $.getScript(markersFile, function() { }); } }); // end of document.ready function The files must be called in the sequence shown as the content of the second file is dependent on the content of the first one and so on. The last two must follow as fourth and fifth but can be in either order. I have tried both with and without using the document.ready function and the results are much the same either way. It also seems to make no difference whether I call these overlay scripts before or after the map is created. Is there a better or more reliable way of ensuring all the (two or five) required javascript files are fully read in the correct sequence before the map page is presented to the user? Thanks
  • Create New...