您的位置:首页 > 理论基础 > 计算机网络

Ajax简单请求示例

2006-07-07 15:30 288 查看
 

请把此代码保存为 ajax.htm 放在IIS服务器里运行!

xmlHttp;
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp = new ActiveXObject();

}
else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}
function startRequest(){
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange ;
xmlHttp.open(,,true);
xmlHttp.send(null);
}
function handleStateChange(){
if(xmlHttp.readyState== ){
if(xmlHttp.status == ){
alert(+xmlHttp.responseText);
}
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息