为什么老是说“loading...”,不显示data.php的内容?
xmlhttp = new XMLHttpRequest();
function getdata () {
xmlhttp.onreadystatechange = function () {
if(xmlhttp.readyState = 4 && xmlhttp.status == 200) {
document.getElementById('data').innerHTML = xmlhttp.responseText;
}
else {
document.getElementById('data').innerHTML = "loading...";
}
}
xmlhttp.open("GET", "data.php", true);
xmlhttp.send();
}