Answer the question
In order to leave comments, you need to log in
How to perform some action if there is a request status in the array?
function TestFunc() {
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
try {
var data = JSON.parse(xhr.responseText);
} catch(err) {
console.log("JSON parse error:", err.message);
console.log("Invalid JSON:", xhr.responseText)
return;
};
}};
xhr.open('GET', 'тут запрос на первый сервер' false);
xhr.send();
}
{"result":"kakie-to slova","id":false}
{"result":"ok","id":"19512591"}
Answer the question
In order to leave comments, you need to log in
Um, what's the question?
if (data.id !== false)
{
doStuff();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question