ajax技术 始终出去发送状态
程序员文章站
2022-04-29 21:57:23
...
ajax.js代码:
var xmlHttp;
function S_xmlhttprequest(){
if(window.ActiveXObject){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(widow.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
}
function funphp100(url){
S_xmlhttprequest();
xmlHttp.open("GET","for.php?id="+url,true);
xmlHttp.onreadystatechange=byphp;
xmlHttp.send(null);
}
function byphp(){
if(xmlHttp.readyState==1){
document.getElementById('php100').innerHTML="loading....";
}
if(xmlHttp.readyState==4){
var byphp100 = xmlHttp.responseText;
document.getElementById('php100').innerHTML=byphp100;
}
}
for.php代码
if($id=$_GET[id]){
for($i=1;$i
echo $i;
sleep(2);
}
exit();
}
?>
index.php代码:
o
t
x
var xmlHttp;
function S_xmlhttprequest(){
if(window.ActiveXObject){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(widow.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
}
function funphp100(url){
S_xmlhttprequest();
xmlHttp.open("GET","for.php?id="+url,true);
xmlHttp.onreadystatechange=byphp;
xmlHttp.send(null);
}
function byphp(){
if(xmlHttp.readyState==1){
document.getElementById('php100').innerHTML="loading....";
}
if(xmlHttp.readyState==4){
var byphp100 = xmlHttp.responseText;
document.getElementById('php100').innerHTML=byphp100;
}
}
for.php代码
if($id=$_GET[id]){
for($i=1;$i
echo $i;
sleep(2);
}
exit();
}
?>
index.php代码:
o
t
x
回复讨论(解决方案)
if($id=$_GET[id]){ for($i=1;$io t x 我那个哪里出现问题了?
else if( widow.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
window谢谢~~~~~~~~~~~
上一篇: Mysql的底层封装