diff --git a/api/views/index.ejs b/api/views/index.ejs index 5c5d3d28..a4a5c51e 100644 --- a/api/views/index.ejs +++ b/api/views/index.ejs @@ -145,6 +145,7 @@ } function connect() { + var received = false; var xhr = new XMLHttpRequest(); xhr.open("GET", "/connect", true); xhr.onreadystatechange = function () { @@ -162,7 +163,12 @@ // console.log(status) 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();