-
Notifications
You must be signed in to change notification settings - Fork 0
/
14-4.html
55 lines (49 loc) · 1.18 KB
/
14-4.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
<!DOCTYPE html>
<html>
<head>
<title>
hi templates
</title>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
</head>
<body>
<div>
div value
</div>
hi this is hi templates <br/>
data from {{value}} <br/>
{{no}}
<button type="button" onclick="led1()">
LED1
</button>
<button type="button" onclick="led2()">
LED2
</button>
<br/>
<span id=btn1>no data</span>
<span id=btn2>no data</span>
<br/>
<img src="{{ url_for('frame')}}">
</body>
</html>
<script type="text/javascript">
// setInterval(update_value, 500) ;
function update_value() {
$.getJSON("/button", function(data) {
console.log(data) ;
// $('#buttonValue').text(data.value) ;
$('#btn1').text(data.btn1) ;
$('#btn2').text(data.btn2) ;
}) ;
}
function led1() {
$.post("/led", {
"led": "1"
}) ;
}
function led2() {
$.post("/led", {
"led": "2"
}) ;
}
</script>