Heim  >  Artikel  >  Backend-Entwicklung  >  关于ajax的简单有关问题,求解答

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

WBOY
WBOYOriginal
2016-06-13 13:15:24895Durchsuche

关于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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn