Have a fun while searching

Thursday, July 28, 2011

status in ajax request and reciev

<html>
<head>

</head>
<body>
<div id="stats">a</div>

<script>

function processStateChange(){
statusDiv = document.getElementById("stats");
if (req.readyState == 0){ statusDiv.innerHTML = "UNINITIALIZED"; }
if (req.readyState == 1){ statusDiv.innerHTML = "LOADING"; }
if (req.readyState == 2){ statusDiv.innerHTML = "LOADED"; }
if (req.readyState == 3){ statusDiv.innerHTML = "INTERACTIVE"; }
if (req.readyState == 4){
statusDiv.innerHTML = "COMPLETE";
statusDiv.innerHTML = req.responseText;
}
}

req = new ActiveXObject("Msxml2.XMLHTTP");
if (req) {
req.onreadystatechange = processStateChange;
req.open("GET", "http://whirlpool.net.au", true);
req.send();
}

</script>
</body>
</html>

0 comments:

Post a Comment