默写AJAX基本框架

来源:互联网 发布:perceptron算法 编辑:程序博客网 时间:2024/04/27 17:48

重新修正了一下javascrit ajax的实例

var xmlhttp=null;if(window.XMLHttpRequest){xmlhttp=new window.XMLHttpRequest();}else if(window.ActiveXObject){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}else{alert("您的浏览器不支持Ajax!");}if(xmlhttp){xmlhttp.onreadystatechange=function(){if (xmlhttp.readyState==0) {console.log(xmlhttp.readyState);};if (xmlhttp.readyState==1) {console.log(xmlhttp.readyState);};if (xmlhttp.readyState==2) {console.log(xmlhttp.readyState);};if (xmlhttp.readyState==3) {console.log(xmlhttp.readyState);};if(xmlhttp.readyState==4&&xmlhttp.status==200){console.log(xmlhttp.readyState);}}xmlhttp.open('GET','http://www.5itbao.cn');xmlhttp.send();}


0 0