是XMLHTTPRequest的一个实例;
只有当状态为200或者304时才会请求成功;
1.XMLHttpRequest 请求数据
`var xhr = new XMLHttpRequest();
xhr.open(‘GET’, url);
xhr.responseType = ‘json’;
xhr.onload = function() {
console.log(xhr.response);
};
xhr.onerror = function() {
console.log(“Oops, error”);
};
xhr.send();`