-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.html
85 lines (78 loc) · 1.76 KB
/
page.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html>
<style>
body {
background-color:gray;
}
.page{
width:100%
}
.card_container{
display: table;
margin: 0 auto;
}
.card{
display:inline-block;
min-height: 250px;
background: #02b875;
padding: 30px;
box-sizing: border-box;
color: #FFF;
margin: 20px;
box-shadow: 0px 2px 18px -4px rgba(0,0,0,0.75);
}
</style>
<body>
<div class="page">
<div class="card_container">
<div class="card">
<h1>Selfie_ESP32 web interface</h1><br>
<h2>Timestamp: <span id="time">0</span></h2><br>
<h2>BT: <span id="BT_DATA">no data</span></h2><br>
<h2>Available WiFi: <span id="WiFi_networks">no data</span></h2><br>
</div>
</div>
</div>
<script>
setInterval(function() {
// Call a function repetatively with 2 Second interval
getData();
getBT();
getWifi();
}, 1000); //2000mSeconds update rate
function getData() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("time").innerHTML =
this.responseText;
}
};
xhttp.open("GET", "readTime", true);
xhttp.send();
}
function getBT() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("BT_DATA").innerHTML =
this.responseText;
}
};
xhttp.open("GET", "readBT", true);
xhttp.send();+++++++++++
}
function getWifi() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("WiFi_networks").innerHTML =
this.responseText;
}
};
xhttp.open("GET", "readWifi", true);
xhttp.send();+++++++++++
}
</script>
</body>
</html>