Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM async Property

XML DOM async Property


Document Object Reference Document Object


Definition and Usage

The async property specifies whether the download of an XML file should be handled asynchronously.

True means that the load() method can return control to the calling program before the download completes.

False means that the download must complete before the calling program regains control.

Syntax

documentObject.async


Example

The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and the 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