only alert once
This commit is contained in:
@@ -145,6 +145,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function connect() {
|
function connect() {
|
||||||
|
var received = false;
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open("GET", "/connect", true);
|
xhr.open("GET", "/connect", true);
|
||||||
xhr.onreadystatechange = function () {
|
xhr.onreadystatechange = function () {
|
||||||
@@ -162,7 +163,12 @@
|
|||||||
// console.log(status)
|
// console.log(status)
|
||||||
document.getElementById("connectedstatus").innerHTML = "Connected: " + status.connected;
|
document.getElementById("connectedstatus").innerHTML = "Connected: " + status.connected;
|
||||||
}
|
}
|
||||||
alert("Could not connect to API!");
|
if (!received)
|
||||||
|
{
|
||||||
|
alert("Could not connect to API!");
|
||||||
|
received = true;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.send();
|
xhr.send();
|
||||||
|
|||||||
Reference in New Issue
Block a user