Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
739b49d
1
Parent(s):
2ab4f80
Update zapro.html
Browse files- zapro.html +25 -30
zapro.html
CHANGED
@@ -14,36 +14,31 @@
|
|
14 |
</head>
|
15 |
<body>
|
16 |
<h1>Zapro</h1>
|
17 |
-
<
|
18 |
-
<
|
19 |
-
|
20 |
-
<script>
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
// Устанавливаем интервал для периодического обновления значений
|
44 |
-
setInterval(fetchValues, 10000);
|
45 |
-
});
|
46 |
-
</script>
|
47 |
|
48 |
</body>
|
49 |
</html>
|
|
|
14 |
</head>
|
15 |
<body>
|
16 |
<h1>Zapro</h1>
|
17 |
+
<div id="ph_value"></div>
|
18 |
+
<div id="ec_value"></div>
|
19 |
+
|
20 |
+
<script>
|
21 |
+
$(document).ready(function() {
|
22 |
+
function updateValues(phValue, ecValue) {
|
23 |
+
$("#ph_value").text(phValue);
|
24 |
+
$("#ec_value").text(ecValue);
|
25 |
+
}
|
26 |
+
|
27 |
+
function fetchValues() {
|
28 |
+
$.ajax({
|
29 |
+
url: "/zapro",
|
30 |
+
method: "GET",
|
31 |
+
dataType: "json",
|
32 |
+
success: function(response) {
|
33 |
+
updateValues(response.ph_value, response.ec_value);
|
34 |
+
}
|
35 |
+
});
|
36 |
+
}
|
37 |
+
|
38 |
+
fetchValues();
|
39 |
+
setInterval(fetchValues, 10000);
|
40 |
+
});
|
41 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
</body>
|
44 |
</html>
|