I need to support major modern browsers only (IE10+, FF, Chrome, Safari)
Can I make this substitution as I want to simplify my code base:
From:
xhr.onreadystatechange = function () {
if (this.readyState === 4) {
if (this.status === 200) {
o.callback(xhr.responseText);
} else {
return false;
}
} else {
return false;
}
};
To:
xhr.onload = function (test) {
o.callback(xhr.responseText);
};
I don't feel that the MDN documentation is clear in this regard.
Clarification:
I choose not to use a framework.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…