1.创建XMLHttpRequest对象,
function readyAJAX(){
try{
return new XMLHttpRequest();
}catch(e){
try{
return new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
return new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
return " A newer browser is needed";
}
}
}
}
---------------------------------------------------------------------------------
2. 处理AJAX
requestObj.onreadystatechange = function() {
if(requestObj.readyState == 4){
if(requestObj.status == 200){
alert(requestObj.responseText);
} else{
alert(requestObj.statusText);
}
}
}
posted on 2011-07-06 22:53
fly 阅读(166)
评论(0) 编辑 收藏 所属分类:
JavaScript学习