robo / zapro.html
DmitrMakeev's picture
Update zapro.html
9c12554 verified
raw
history blame
1.87 kB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>My static Space</title>
<link rel="stylesheet" href="https://huggingface.co/spaces/vk-ai-system/flask_inference_api/resolve/main/style.css" />
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<h1>Онлайн данные системы</h1>
<p>День : <span id="dey"></span></p>
<p>Неделя: <span id="wek"></span></p>
<br>
<p>PH раствора: <span id="ph"></span></p>
<p>EC раствора: <span id="ec"></span></p>
<p>Т. раствора: <span id="tS"></span></p>
<p>Т. воздуха: <span id="tA"></span></p>
<p>Вл. воздуха: <span id="hDm"></span></p>
<p>Об. вентилятора: <span id="sVen"></span></p>
<script>
function updateValues(data) {
document.getElementById("dey").textContent = data.dey;
document.getElementById("wek").textContent = data.wek;
document.getElementById("ph").textContent = data.ph;
document.getElementById("ec").textContent = data.ec;
document.getElementById("tS").textContent = data.tS;
document.getElementById("tA").textContent = data.tA;
document.getElementById("hDm").textContent = data.hDm;
document.getElementById("sVen").textContent = data.sVen;
}
function fetchValues() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/zapro", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
var response = JSON.parse(xhr.responseText);
updateValues(response);
}
};
xhr.send();
}
fetchValues();
setInterval(fetchValues, 10000);
</script>
</body>
</html>