<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <input type="button" id="bnt" value="请求"/> <div id="d1"></div> <script type="text/javascript"> var bnt=document.getElementById('bnt') bnt.onclick=function (){ // 1 创建对象 var oAjax=null; if(window.XMLHttpRequest){ oAjax=new XMLHttpRequest() }else{ oAjax=new ActiveXObject("Microsoft.XMLHTTP") } // 2 连接服务器 oAjax.open("GET","http://101.201.252.11/mt/main.php?case=news_list&hid=0?t="+Math.random(),true); // 3 发送请求 oAjax.send(null) //接受服务器返回 oAjax.onreadystatechange=function (){ if(oAjax.readyState==4){ if(oAjax.status==200){ console.log("开始处理数据"); var arr = JSON.parse(oAjax.responseText); var data=arr.data_list; console.log(data[3].content); d1.innerHTML=data[3].content; //console.log(); //arr.split(",") //alert(arr[3])oAjax.responseText //alert(oAjax.responseText) }else{ alert("请求失败") } } } } </script> </body> </html>