Spaces:
test-sj-crm
/
Runtime error

DmitrMakeev commited on
Commit
9c12554
1 Parent(s): 59b84b3

Update zapro.html

Browse files
Files changed (1) hide show
  1. zapro.html +35 -31
zapro.html CHANGED
@@ -14,39 +14,43 @@
14
  </head>
15
  <body>
16
  <h1>Онлайн данные системы</h1>
17
- <p>День : <span id="dey">{{ dey }}</span></p>
18
- <p>Неделя: <span id="wek">{{ wek }}</span></p>
19
  <br>
20
- <p>PH раствора: <span id="ph">{{ ph }}</span></p>
21
- <p>EC раствора: <span id="ec">{{ ec }}</span></p>
22
- <p>Т. раствора: <span id="tS">{{ tS }}</span></p>
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>
 
14
  </head>
15
  <body>
16
  <h1>Онлайн данные системы</h1>
17
+ <p>День : <span id="dey"></span></p>
18
+ <p>Неделя: <span id="wek"></span></p>
19
  <br>
20
+ <p>PH раствора: <span id="ph"></span></p>
21
+ <p>EC раствора: <span id="ec"></span></p>
22
+ <p>Т. раствора: <span id="tS"></span></p>
23
+ <p>Т. воздуха: <span id="tA"></span></p>
24
+ <p>Вл. воздуха: <span id="hDm"></span></p>
25
+ <p>Об. вентилятора: <span id="sVen"></span></p>
26
+
27
  <script>
28
+ function updateValues(data) {
29
+ document.getElementById("dey").textContent = data.dey;
30
+ document.getElementById("wek").textContent = data.wek;
31
+ document.getElementById("ph").textContent = data.ph;
32
+ document.getElementById("ec").textContent = data.ec;
33
+ document.getElementById("tS").textContent = data.tS;
34
+ document.getElementById("tA").textContent = data.tA;
35
+ document.getElementById("hDm").textContent = data.hDm;
36
+ document.getElementById("sVen").textContent = data.sVen;
37
+ }
38
+
39
+ function fetchValues() {
40
+ var xhr = new XMLHttpRequest();
41
+ xhr.open("GET", "/zapro", true);
42
+ xhr.setRequestHeader("Content-Type", "application/json");
43
+ xhr.onreadystatechange = function () {
44
+ if (xhr.readyState === 4 && xhr.status === 200) {
45
+ var response = JSON.parse(xhr.responseText);
46
+ updateValues(response);
47
+ }
48
+ };
49
+ xhr.send();
50
+ }
51
+
52
+ fetchValues();
53
+ setInterval(fetchValues, 10000);
54
  </script>
55
  </body>
56
  </html>