如何获取通过ajax请求的html代码 例如淘宝信誉的页面:http://rate.taobao.com/user-rate-8eea0e758eb438c5a0959dd643baf78d.htm中的评价,见图中所标示的是通过ajax请求的; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 利用回调函数获取服务器返回的结果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); } } } 我意思是获取远程的html代码,而远程网站上的的html代码是通过ajax实现的,你这个貌似获取不到远程的通过ajax请求的html吧 url = "manage_action_class.php?"&ran="+Math.random(); //后端请求页面#将这句改为你要访问的地址不就行了? <li class="current" rel="[[587,{'rater':'0','direction':'0','result':'1','timeLine':'-30'}],[4,{'rater':'0','direction':'0','result':'0','timeLine':'-30'}],[0,{'rater':'0','direction':'0','result':'-1','timeLine':'-30'}]]">最近一月</li>他的数据不是在 rel 属性里吗? 关于PHP论坛权限问题 serialize与unserialize Warning: array_key_exists() [function.array-key-exists]: The second argument sho 数据取整!! 50分,问些基础的知识。 传值,简单问题 有比PHP+mysql更快的web动态组合么? 有关论坛上传图片的问题 关于PHP上传文件的问题,急啊~~~~~~~ 请教怎么可以把文件名改成以中文命名???????? 求php开发类似酷狗乐音视频?? mysql 两个数据库中表的结构不同,怎么把一个表中的数据导入到另一个表中
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);
}
}
}
#将这句改为你要访问的地址不就行了?