ajax使用小示例

<script>
function test() {
    liveReq = new ActiveXObject("Microsoft.XMLHTTP");
 liveReq.onreadystatechange = function(){liveReqProcessReqChange();};
 liveReq.open("GET", "http://news.163.com");
 liveReq.send(null);
}


function liveReqProcessReqChange() {
 if (liveReq.readyState == 4) {
  document.getElementById('show').innerHTML = liveReq.responseText;
 }
}

test();
alert("ok");

</script>

<div id="show"></div>
 

你可能感兴趣的:(ajax使用小示例)