Latest web development tutorials

XML DOM async attribute

Document Object Reference Document Object

Definition and Usage

Async attribute specifies whether the XML file downloads should be handled asynchronously.

True means the load () method returns control to the calling program before the download is complete.

False means that must be completed before downloading the calling program to retrieve control.

grammar

documentObject.async


Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc, loadXMLDoc () function uses the async property:

function loadXMLDoc(dname)
{
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e) {alert(e.message)}
}
try
{
xmlDoc.async=false;
xmlDoc.load(dname);
return(xmlDoc);
}
catch(e) {alert(e.message)}
return(null);
}


Document Object Reference Document Object