mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-21 14:09:59 +01:00
version 1.4
- changed webinterface design - improved error handling - can add clients manually - added settings reset via console command "reset" and GPIO 4 - improved default settings for more stability - added warning at the beginning - added info page
This commit is contained in:
36
web_server/html/js/functions.js
Normal file
36
web_server/html/js/functions.js
Normal file
@@ -0,0 +1,36 @@
|
||||
function showMessage(msg, closeAfter){
|
||||
document.getElementById("error").innerHTML = msg;
|
||||
if(closeAfter !== undefined){
|
||||
setTimeout(function(){
|
||||
document.getElementById("error").innerHTML = "";
|
||||
},closeAfter);
|
||||
}
|
||||
}
|
||||
|
||||
function getE(name){
|
||||
return document.getElementById(name);
|
||||
}
|
||||
|
||||
function getResponse(adr, callback, timeoutCallback, timeout, method){
|
||||
if(timeoutCallback === undefined) {
|
||||
timeoutCallback = function(){
|
||||
showMessage("error loading "+adr);
|
||||
};
|
||||
}
|
||||
if(timeout === undefined) timeout = 8000;
|
||||
if(method === undefined) method = "GET";
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if(xmlhttp.readyState == 4){
|
||||
if(xmlhttp.status == 200){
|
||||
showMessage("");
|
||||
callback(xmlhttp.responseText);
|
||||
}
|
||||
else timeoutCallback();
|
||||
}
|
||||
};
|
||||
xmlhttp.open(method, adr, true);
|
||||
xmlhttp.send();
|
||||
xmlhttp.timeout = timeout;
|
||||
xmlhttp.ontimeout = timeoutCallback;
|
||||
}
|
||||
Reference in New Issue
Block a user