js creative testing

master
const an teen 2021-12-29 13:42:40 -05:00
parent 308cadd9b0
commit 4b91d372c2
1 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ function toAJAX()
xhttp.onload = function() {
if (reqIsFailed) {
reqIsFailed = false;
appendMessage("", "<b style=\"color: green\">Fine: you are online again</b>")
objPath.removeAttribute("style", "color: red");
}
const answer = JSON.parse(xhttp.responseText);
@ -65,10 +65,10 @@ function toAJAX()
}
if (answer.serverStatusChanged) {
if (answer.serverStatus) {
appendMessage("***", "Connected to server. Ready to handle new messages!")
objPath.removeAttribute("style", "color: red");
objCurrentServerStatus.innerText = HTML_SERVER_ONLINE_MARKER;
} else {
appendMessage("***", "Disconnected from server. Reconnecting...")
objPath.setAttribute("style", "color: red");
objCurrentServerStatus.innerText = HTML_SERVER_OFFLINE_MARKER;
}
}
@ -88,7 +88,7 @@ function toAJAX()
xhttp.onerror = function() {
if (!reqIsFailed) {
reqIsFailed = true;
appendMessage("", "<b style=\"color: red\">Request is failed: no response from server</b>")
objPath.setAttribute("style", "color: red");
}
}