第一步
处理IE8兼容问题
try{
xml = new XMLHttpRequest()
}catch{
xml = new ActiveXObject('Microsoft.XMLHTTP')
}
第二部
xml.onreadystatechange=function({
if(xml.readystate==4 && xml.status==200){
console.log(xml.response)
}
})
第三部
xml.open('get','地址')
// 如果用post方法的话需要配置请求头信息
xml.setRequestHeader('Content-type','application/x-www-form-urlencoded')
第四部
xml.send()