2024-07-06 20:37:22 +02:00
|
|
|
function callURL(url)
|
|
|
|
{
|
|
|
|
var xmlhttp = new XMLHttpRequest();
|
|
|
|
xmlhttp.open("GET", url, true);
|
|
|
|
xmlhttp.send();
|
|
|
|
}
|
|
|
|
|
|
|
|
function getjson(url, handler_func)
|
|
|
|
{
|
|
|
|
var xmlhttp = new XMLHttpRequest();
|
|
|
|
xmlhttp.onreadystatechange = function () {
|
|
|
|
if(this.readyState == 4 && this.status == 200) {
|
|
|
|
var data = JSON.parse(this.responseText);
|
|
|
|
handler_func(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
xmlhttp.open("GET", url, true);
|
|
|
|
xmlhttp.send();
|
|
|
|
}
|
|
|
|
|
2024-08-29 23:16:01 +02:00
|
|
|
function getSensorData(handler_func)
|
2024-07-06 20:37:22 +02:00
|
|
|
{
|
2024-08-29 23:16:01 +02:00
|
|
|
return getjson("/api/readout", handler_func);
|
2024-07-06 20:37:22 +02:00
|
|
|
}
|