readyState == 4 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

readyState == 4

Hi,

Question.. Why is it when I use the following code:

var xmlDoc = new ActiveXObject("microsoft.xmldom");
xmlDoc.load("GebruikersDatabase.xml");
alert('De gebruikersdatabase wordt benaderd...');
if(xmlDoc.readyState != 4)
{
alert('De gebruikersdatabase kon niet worden benaderd.');
return;
}
Everything works, but when I lose the alertbox it doesn't...
I thought there wasn't enough time for the database to be loaded, but when I build in a for loop for(x=0;x<100000;x++){}
it doesn't work either. Only when I put in an alert box but this is very irritating... I have to open three xml files in one function, so a user would have to click threetimes first, before the page is ready...

Does someone have an alternative code...
On my workstation everything works alright without the alert, but when I upload my page to the Internet it doesn't...

Hope you can help me out here...

greetzzz,
mac
the Netherlands

Comments

  • mac_doggiemac_doggie Posts: 488Member
    I've allready found the solution. Someone replied to this same message in the Internet developement thread.

    I used xmlDox1.async=false; and it helped...

    Thanks anyway...

    : Hi,
    :
    : Question.. Why is it when I use the following code:
    :
    : var xmlDoc = new ActiveXObject("microsoft.xmldom");
    : xmlDoc.load("GebruikersDatabase.xml");
    : alert('De gebruikersdatabase wordt benaderd...');
    : if(xmlDoc.readyState != 4)
    : {
    : alert('De gebruikersdatabase kon niet worden benaderd.');
    : return;
    : }
    : Everything works, but when I lose the alertbox it doesn't...
    : I thought there wasn't enough time for the database to be loaded, but when I build in a for loop for(x=0;x<100000;x++){}
    : it doesn't work either. Only when I put in an alert box but this is very irritating... I have to open three xml files in one function, so a user would have to click threetimes first, before the page is ready...
    :
    : Does someone have an alternative code...
    : On my workstation everything works alright without the alert, but when I upload my page to the Internet it doesn't...
    :
    : Hope you can help me out here...
    :
    : greetzzz,
    : mac
    : the Netherlands
    :
    :

Sign In or Register to comment.