Home >Backend Development >PHP Tutorial > 关于ajax的简单有关问题,求解答

关于ajax的简单有关问题,求解答

WBOY
WBOYOriginal
2016-06-13 13:15:24961browse

关于ajax的简单问题,求解答。
下面是我的完整代码,为什么点了o,x,t之后都没有反应呢,按道理应该是下面会多出一些内容的,大家知道为什么吗?

var xmlHttp;
function xmlhttprequest() {

if(window.ActiveXObject){
xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
}else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}

}

function funphp100(url){
xmlhttprequest();
xmlHttp.open("GET","for.php?id="+url,"true");
xmlHttp.onreadystatechange = byphp;
xmlHttp.send(null);
}

function byphp(){

if(xmlHttp.readyState==1){
document.getElementById('php100').innetHTML = "loading......";
}

if(xmlHttp.readyState==4){
if(xmlHttp.Status==200){
var byphp100 = xmlHttp.responseText;
document.getElementById('php100').innetHTML = byphp100;
}
}
}


for.php


for($i=1;$i echo $i."$id
";
}
?>


index.php




o
t
x




------解决方案--------------------
是 innerHTML 而不是 innetHTML
------解决方案--------------------
if(xmlHttp.status==200){ //小写s

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn