Spaces:
Runtime error
Runtime error
DmitrMakeev
commited on
Commit
•
59b84b3
1
Parent(s):
185ffb8
Update zapro.html
Browse files- zapro.html +14 -18
zapro.html
CHANGED
@@ -23,34 +23,30 @@
|
|
23 |
<p>Т. воздуха: <span id="tA">{{ tA }}</span></p>
|
24 |
<p>Вл. воздуха: <span id="hDm">{{ hDm }}</span></p>
|
25 |
<p>Об. вентилятора: <span id="sVen">{{ sVen }}</span></p>
|
|
|
26 |
<script>
|
27 |
-
|
28 |
function updateValues(deyValue, wekValue, phValue, ecValue, tSValue, tAValue, hDmValue, sVenValue) {
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
}
|
38 |
|
39 |
function fetchValues() {
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
success: function(response) {
|
45 |
-
updateValues(response.dey, response.wek, response.ph, response.ec, response.tS, response.tA, response.hDm, response.sVen);
|
46 |
-
}
|
47 |
-
});
|
48 |
}
|
49 |
|
50 |
fetchValues();
|
51 |
setInterval(fetchValues, 10000);
|
52 |
});
|
53 |
</script>
|
54 |
-
|
55 |
</body>
|
56 |
</html>
|
|
|
23 |
<p>Т. воздуха: <span id="tA">{{ tA }}</span></p>
|
24 |
<p>Вл. воздуха: <span id="hDm">{{ hDm }}</span></p>
|
25 |
<p>Об. вентилятора: <span id="sVen">{{ sVen }}</span></p>
|
26 |
+
|
27 |
<script>
|
28 |
+
document.addEventListener("DOMContentLoaded", function() {
|
29 |
function updateValues(deyValue, wekValue, phValue, ecValue, tSValue, tAValue, hDmValue, sVenValue) {
|
30 |
+
document.getElementById("dey").textContent = deyValue;
|
31 |
+
document.getElementById("wek").textContent = wekValue;
|
32 |
+
document.getElementById("ph").textContent = phValue;
|
33 |
+
document.getElementById("ec").textContent = ecValue;
|
34 |
+
document.getElementById("tS").textContent = tSValue;
|
35 |
+
document.getElementById("tA").textContent = tAValue;
|
36 |
+
document.getElementById("hDm").textContent = hDmValue;
|
37 |
+
document.getElementById("sVen").textContent = sVenValue;
|
38 |
}
|
39 |
|
40 |
function fetchValues() {
|
41 |
+
fetch("/zapro")
|
42 |
+
.then(response => response.json())
|
43 |
+
.then(data => updateValues(data.dey, data.wek, data.ph, data.ec, data.tS, data.tA, data.hDm, data.sVen))
|
44 |
+
.catch(error => console.error("Error:", error));
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
|
47 |
fetchValues();
|
48 |
setInterval(fetchValues, 10000);
|
49 |
});
|
50 |
</script>
|
|
|
51 |
</body>
|
52 |
</html>
|