ホームページ >バックエンド開発 >PHPチュートリアル >Ajax テクノロジーは常にステータスを送信します。
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代码
bcd5e0b55f43ac82f6090360ab9d9817
index.php代码:
760cc17eb142eb7c1d0ee6103289716b2cacc6d41bbb37262a98f745aa00fbf0
1002f1006c437345fef3209369dda4b8o5db79b134e9f6b82c0b36e0489ee08ed
0710f74ca45c1c39fda6e1867e13b83bt5db79b134e9f6b82c0b36e0489ee08ed
4cba8eecfbf0392c90c962d7b9df1790x5db79b134e9f6b82c0b36e0489ee08ed
0c6dc11e160d3b678d68754cc175188a
ae7db4cd1435ff29c9a87b5e85842f5116b28748ea4df4d9c2150843fecfba68
if($id=$_GET[id]){ for($i=1;$i<=5;$i++){echo $i;//sleep(2); } exit();}
<html><head> <title> </title> <script type="text/javascript" src='jquery-1.4.2.min.js'></script></head><script type="text/javascript"> var xmlHttp; function S_xmlhttprequest(){ if(window.ActiveXObject){ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } else if(window.XMLHttpRequest){ xmlHttp=new XMLHttpRequest(); } } function funphp100(url){ S_xmlhttprequest(); xmlHttp.open("GET","test.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; } }</script><body> <a href= "#" onclick="funphp100('o')">o</a> <a href= "#" onclick="funphp100('t')">t</a> <a href= "#" onclick="funphp100('x')">x</a> <br> <div id="php100"></div></body></html>
我那个哪里出现问题了?
else if( widow.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
ウィンドウ
谢谢~~~~~~~~~~~