Code has been added to clipboard!
Quick Data Find by Reading XML File
Example
<html>
<head>
<script>
function showCD(str) {
if (str == '') {
document.getElementById("txt_hint").innerHTML = '';
return;
}
if (window.XMLHttpRequest) {
// script for browser version above IE 7 and the other popular browsers (newer browsers)
xmlhttpreq = new XMLHttpRequest();
} else {
// script for the IE 5 and 6 browsers (older versions)
xmlhttpreq = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttpreq.onreadystatechange = function() {
//check if server response is readyÂ
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txt_hint").innerHTML = this.responseText;
}
}
xmlhttpreq.open("GET", "get_cd.php?q="+str, true);
xmlhttpreq.send();
}
</script>
</head>
<body>
<form>
Select a CD:
<select name="cds" onchange="show_cd(this.value)">
<option value="">Select a CD:</option>
<option value="Alice Cooper">Alice Cooper</option>
<option value="John Lennon">John Lennon</option>
<option value="Frank Zappa">Frank Zappa</option>
</select>
</form>
<div id="txt_hint"><b>This is where the info about CDs goes!</b></div>
</body>
</html>