【发布时间】:2012-10-30 18:20:45
【问题描述】:
这是我的代码 sn-p,无法理解这是什么问题,因为 xmlhttp.readyState 没有更改为 4。
document.getElementById("opencloseimg").src = "images/minus.jpg";
//The page we are loading.
var serverPage = "calendar.php";
//Set the open close tracker variable.
showCalendar = false;
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage,true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
【问题讨论】:
-
你在哪里定义
xmlhttp? -
现在有很多不错的 jQuery 库可供使用。使用它们并避免这种笨拙的
xmlhttp东西。
标签: php javascript xml ajax