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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.