21,887
社区成员
发帖
与我相关
我的任务
分享
url = "manage_action_class.php?"&ran="+Math.random(); //后端请求页面
#将这句改为你要访问的地址不就行了?
var xmlHttp;
function createXMLHttpRequest() {
if(window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
function routeList(){
createXMLHttpRequest();
url = "manage_action_class.php?"&ran="+Math.random(); //后端请求页面
method = "GET"; //传输方式
xmlHttp.open(method,url,true);
xmlHttp.onreadystatechange = showList; //这里为回调函数
xmlHttp.send(null);
}
function showList(){
if (xmlHttp.readyState == 4){
if (xmlHttp.status == 200){
var text = xmlHttp.responseText; //这里获得服务器返回的数据
document.getElementById("route").innerHTML = text; //将数据放入html指定div中
}else {
alert("response error code:"+xmlHttp.status);
}
}
}