XMLHttpRequest

<script type= "text/javascript "> var xmlHttp; function createXMLHttpRequest() { if (window.ActiveXObject) { xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP "); } else if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } }
function startRequest()

{ createXMLHttpRequest();

xmlHttp.onreadystatechange = handleStateChange; xmlHttp.open( "GET ", "simpleResponse.xml ", true); xmlHttp.send(null); }
function handleStateChange()

{ if(xmlHttp.readyState == 4)

{ if(xmlHttp.status == 200)

 { alert( "The server replied with: " + xmlHttp.responseText); }//else alert( "in: "+xmlHttp.status); }//else alert( "out: "+xmlHttp.readyState); } </script>

posted @ 2011-12-01 13:12  Angkor--:--  阅读(159)  评论(0编辑  收藏  举报