Spaces:
test-sj-crm
/
Runtime error

DmitrMakeev commited on
Commit
59b84b3
1 Parent(s): 185ffb8

Update zapro.html

Browse files
Files changed (1) hide show
  1. 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
- $(document).ready(function() {
28
  function updateValues(deyValue, wekValue, phValue, ecValue, tSValue, tAValue, hDmValue, sVenValue) {
29
- $("#dey").text(deyValue);
30
- $("#wek").text(wekValue);
31
- $("#ph").text(phValue);
32
- $("#ec").text(ecValue);
33
- $("#tS").text(tSValue);
34
- $("#tA").text(tAValue);
35
- $("#hDm").text(hDmValue);
36
- $("#sVen").text(sVenValue);
37
  }
38
 
39
  function fetchValues() {
40
- $.ajax({
41
- url: "/zapro",
42
- method: "GET",
43
- dataType: "json",
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>