异步的Ajax和xml用于快速创建动态网页技术部分数据刷新
写法:
function btnclick(){
//创建核心对象
xmlhttp=null;
if(window.XMLHTTPRequest){
xmlhttp=new XMLHTTPRequest
}else if( window.ActiveXObject){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
//编写回调函数
xmlhttp.onreadystatechange=function(){
//readyState 属性返回当前文档的状态
if(xmlhttp.readyState==4&&xmlhttp.status=200){
alert(xmlhttp.responseText);
}
}
//设置请求方式与请求路径
xmlhttp.open("get","1");
//send发送
xmlhttp.send();
}