Example of XmlHttp asynchronous data retrieval from a website

by david55 on 2008-05-21 23:47:23

This article is placed here as a backup.

```html

var oDiv

var xh

function getXML()

{

oDiv = document.all.m

oDiv.innerHTML = "Loading column data, please wait.......";

oDiv.style.display= "";

xh = new ActiveXObject("Microsoft.XMLHTTP")

xh.onreadystatechange = getReady

xh.open("GET",a.value,true)

xh.send()

}

function getReady()

{

if(xh.readyState==4)

{

if(xh.status==200)

{

oDiv.innerHTML = "Completed";

}

else

{

oDiv.innerHTML = "Sorry, data loading failed. Reason: " + xh.statusText

}

}

}

An example of xmlhttp asynchronous:

URL:

```

**Note:** The above script uses `ActiveXObject`, which is specific to older versions of Internet Explorer and may not work in modern browsers due to security restrictions and lack of support for `ActiveXObject`. For cross-browser compatibility, consider using the `XMLHttpRequest` object or modern Fetch API instead.