Examine the following code. function getData() { var url = "ajaxdata/citStudents.txt"; var request = new XMLHttpRequest(); request.open("GET", url); request.onreadystatechange = function() { if (request.readyState == 4 && request.status == 200) { alert(request.responseText); } }; request.send(null); } What does it mean if the condition (request.readyState == 4 && request.status == 200) evaluates as true? it means there were was an HTTP error and that the data will not be returned to the browser. it means there were no http errors and that the data has been returned to the browser. it means the request has been sent and data will be back in 200 milliseconds or less.
Please, explain. Thank you!
Examine the following code.
function getData() {
var url = "ajaxdata/citStudents.txt";
var request = new XMLHttpRequest();
request.open("GET", url);
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
alert(request.responseText);
}
};
request.send(null);
}
What does it mean if the condition (request.readyState == 4 && request.status == 200) evaluates as true?
it means there were was an HTTP error and that the data will not be returned to the browser. |
||
it means there were no http errors and that the data has been returned to the browser. |
||
it means the request has been sent and data will be back in 200 milliseconds or less. |
Trending now
This is a popular solution!
Step by step
Solved in 3 steps