Last active
January 25, 2016 11:40
-
-
Save serebrov/6e8fa5312f80c9d53102 to your computer and use it in GitHub Desktop.
Test html page for http://stackoverflow.com/q/34974727/4612064
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Test ajax</title> | |
</head> | |
<body> | |
<script> | |
function showCat(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 (xmlhttp.readyState == 4 && xmlhttp.status == 200) { | |
document.getElementById("txtHint").innerHTML = xmlhttp.responseText; | |
} | |
}; | |
xmlhttp.open("GET","getcat.php?q="+str,true); | |
xmlhttp.send(); | |
} | |
} | |
</script> | |
<table> | |
<tr> | |
<td> | |
<div> | |
<a onclick="showCat('95')">showCat('95')</a> | |
<a onclick="showCat('23')">showCat('23')</a> | |
<a onclick="showCat('55')">showCat('55')</a> | |
<a onclick="showCat('65')">showCat('65')</a> | |
</div> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<div id="txtHint"> | |
</div> | |
</td> | |
</tr> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment