XMLHttpRequest
難以閱讀與撰寫
code:javascript
const result = document.querySelector(".result");
function reqOnload() {
const data = JSON.parse(this.responseText);
var email = data.results0.email; result.textContent = email;
}
function reqError(err) {
console.log(err);
}
var request = new XMLHttpRequest();
request.send();
request.onload = reqOnload;
request.onerror = reqError;