mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-22 14:40:05 +01:00
13 lines
441 B
JavaScript
13 lines
441 B
JavaScript
function getResponse(adr, callback, timeoutCallback = function(){location.reload()}, timeout = 5000){
|
|
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;
|
|
} |