-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAJAX_countElements.html
55 lines (48 loc) · 1004 Bytes
/
AJAX_countElements.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<html>
<head>
<script language="javascript">
function loadXMLDoc()
{
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","http://www.google.com/",true);
xmlhttp.send();
var responseText;
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==0)
{
alert("request not initialized");
}
if (xmlhttp.readyState==1)
{
alert("server connection established");
}
if (xmlhttp.readyState==2)
{
alert("request recieved");
}
if (xmlhttp.readyState==3)
{
alert("processinmg request");
}
if (xmlhttp.readyState==4)
{
alert("response ready");
if(xmlhttp.status == 200)
{
alert("response successful");
responseText=xmlhttp.responseText; // CONSUME SERVER RESPONSE AND CLOSE !!!
self.close();
}
}
}
//document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
</script>
</head>
<body onLoad="loadXMLDoc()">
<div id="mydiv">
</div>
</body>
</html>