-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfindemployeeajax2.html
40 lines (39 loc) · 1.04 KB
/
findemployeeajax2.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
<html>
<head>
<script>
function showUser(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","findemployeeajax.php?lastname="+str,true);
xmlhttp.send();
}
}
</script>
</head>
<body>
<h2>AJAX Example Find Example With Hints</h2>
<form>
Last name:
<br>
<input type="text" name="lastname" value="" onkeyup="showUser(this.value)">
<br><br>
<input type="submit" value="Submit">
</form>
<br>
<div id="txtHint"><b>Person info will be listed here...</b></div>
</body>
</html>