Splitted JS part of the HTML files

This commit is contained in:
N0vaPixel
2017-03-12 23:31:16 +01:00
parent 038fe10b21
commit 6a52e70ea7
22 changed files with 1075 additions and 1036 deletions

View File

@@ -0,0 +1,28 @@
function getResponse(adr, callback, timeoutCallback, timeout){
if(timeoutCallback === undefined) {
timeoutCallback = function(){
location.reload()
};
}
if(timeout === undefined) {
timeout = 8000;
}
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4){
if(xmlhttp.status == 200) callback(xmlhttp.responseText);
else timeoutCallback();
}
};
xmlhttp.open("GET", adr, true);
xmlhttp.send();
xmlhttp.timeout = timeout;
xmlhttp.ontimeout = timeoutCallback;
}
function restartESP() {
getResponse("restartESP.json", function(responseText) {
if (responseText == "true") getData();
else alert("error");
});
}