我试图将4个参数从下拉列表传递给Ajax,但出现以下错误:
未捕获的TypeError:无法在以下位置设置null的属性“ innerHTML” XMLHttpRequest.xmlhttp.onreadystatechange
function showreports() {
var str = document.getElementById("p").value;
var str1 = document.getElementById("t").value;
var str2 = document.getElementById("sem").value;
var str3 = document.getElementById("ses").value;
if (str == 0) {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET", "get_reports.php?p=" + str, true);
xmlhttp.send();
}
}