-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
55 lines (43 loc) · 1.37 KB
/
index.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 lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web LED Controller</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
$(document).ready(function(){
$('#on_1').click(function(){
httpGet("http://*/?serverfunction=redLedSwitch&value=1");
});
$('#off_1').click(function(){
httpGet("http://*/?serverfunction=redLedSwitch&value=0");
});
$('#on_2').click(function(){
httpGet("http://*/?serverfunction=blueLedSwitch&value=1");
});
$('#off_2').click(function(){
httpGet("http://*/?serverfunction=blueLedSwitch&value=0");
});
// get
function httpGet( theUrl ){
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( 'GET', theUrl, false );
xmlHttp.send( null );
return xmlHttp.responseText;
}
});
</script>
</head>
<body>
<h3>RED LED</h3>
<button id="on_1" class="btn btn-success">On</button>
<button id="off_1" class="btn btn-danger">Off</button>
<br/><br/><br/><br/>
<h3>BLUE LED</h3>
<button id="on_2" class="btn btn-success">On</button>
<button id="off_2" class="btn btn-danger">Off</button>
</body>
</html>