-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshowData.js
More file actions
48 lines (44 loc) · 789 Bytes
/
showData.js
File metadata and controls
48 lines (44 loc) · 789 Bytes
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
var xmlHttp;
function showData(id)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp===null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="search.php";
url=url+"?id="+id;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState===4 || xmlHttp.readyState==="complete")
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}