-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpage.html
More file actions
32 lines (29 loc) · 947 Bytes
/
webpage.html
File metadata and controls
32 lines (29 loc) · 947 Bytes
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
<!--
this will cause redirection in the webpage
<form action = "http://192.168.6.249/onRed" method = "POST">
<input type = "submit">
</form> -->
<p>
<input type = "submit" value="Off LED" onclick="offSubmit()"
style="background-color:red;color:black;border-radius:25px">
</input>
</p>
<p>
<input type = "submit" value="On LED" onclick="onSubmit()"
style="background-color:green;color:black;border-radius:25px ">
</input>
</p>
<script>
function onSubmit() {
var req = new XMLHttpRequest();
req.open('get', 'http://192.168.6.249/onRed', true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
req.send();
}
function offSubmit() {
var req = new XMLHttpRequest();
req.open('get', 'http://192.168.6.249/offRed', true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
req.send();
}
</script>