41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
function showHint(str) {
|
|
if (str.length === 0) {
|
|
document.getElementById("txtHint").innerHTML = "";
|
|
} else {
|
|
let xmlhttp = new XMLHttpRequest();
|
|
xmlhttp.onreadystatechange = function() {
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
var uic = document.getElementById("txtHint")
|
|
uic.innerHTML = this.responseText;
|
|
}
|
|
};
|
|
xmlhttp.open("GET", "gethint.php?q=" + str, true);
|
|
xmlhttp.send();
|
|
}
|
|
}
|
|
|
|
function showHintSelect(str) {
|
|
if (str.length === 0) {
|
|
document.getElementById("txtHint").innerHTML = "";
|
|
} else {
|
|
let xmlhttp = new XMLHttpRequest();
|
|
xmlhttp.onreadystatechange = function() {
|
|
if (this.readyState === 4 && this.status === 200) {
|
|
let select = document.getElementById("resultsSelectionBox")
|
|
let names = this.responseText.split(',');
|
|
for (let i = 0; i<names.length; i++) {
|
|
let opt = document.createElement('option');
|
|
opt.value = names[i];
|
|
opt.innerHTML = names[i];
|
|
select.appendChild(opt);
|
|
}
|
|
let hint = document.getElementById("txtHint")
|
|
hint.innerHTML = this.responseText;
|
|
}
|
|
};
|
|
xmlhttp.open("GET", "gethint.php?q=" + str, true);
|
|
xmlhttp.send();
|
|
}
|
|
}
|
|
|