// http://study.163.com/webDev/couresByCategory.htm
// http://study.163.com/webDev/couresByCategory.htm?pageNo=1&psize=20&type=20
// https://xhr.spec.whatwg.org/#states
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
var xhr = new XMLHttpRequest();
console.log('新建xhr对象,readyState的值:' + xhr.readyState);
xhr.open('GET', 'http://study.163.com/webDev/couresByCategory.htm?pageNo=1&psize=20&type=20');
console.log('使用open方法后,readyState的值:' + xhr.readyState);
xhr.send();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
console.log(xhr.statusText);
console.log(xhr.responseText);
}
};