View Full Version : Need to wait for data to load

09-08-2006, 12:37 AM
I have an island which says: <xml id="myXML" ondatasetcomplete="relatedRelationshipsComplete()" src async="false"></xml>

Now, I want to do the processing in the same function where I set the src.
When I say xmlRelatedRelationships.src = "URL"; the next line I say var tmp = myXML.selectSingleNode("//MYNODE"); At this line I get the Javascript error "The data necessary to complete this operation is not available".

I know I have to wait for the data to get loaded. Can something be put in between: myXML.src = "URL"; and var tmp = myXML.selectSingleNode("//MYNODE"); so that the code waits until the data is loaded and then carries on? I am putting an alert which solves the purpose but I do not want users to click on an alert and then view the data on the page :o .

09-08-2006, 06:39 PM
you need to have a callback function to handle the data after it loads.

in that function run your code.