xhr= new XMLHttpRequest(); xhr.open('GET','http://cdn.jsrun.top/css/img/logo@2x.png',true);//第三个参数指定异步/同步 xhr.send(); xhr.onreadystatechange=function(){ console.log(xhr.readyState,xhr.status) console.log(xhr.responseText,xhr.responseXML,xhr) } xhr.onload=function(){ console.log('onload',xhr.readyState) } xhr.onloadend=()=>console.log('loadend',xhr.readyState) xhr.onprogress=()=>console.log('progress',xhr.readyState) xhr.onloadstart=()=>console.log('start',xhr.readyState)