Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Klint Youngmeyer
PicoTestSite
Commits
a539f68f
Commit
a539f68f
authored
Dec 06, 2019
by
Klint Youngmeyer
Browse files
Add button and javascript function to page2 to toggle LED, using 'REST' API
parent
89bbbcdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
www/page2.html
View file @
a539f68f
...
...
@@ -28,10 +28,24 @@
</center>
<HR>
<H2>
This is the second page
</H2>
<p>
This page is just to demonstrate linking to other local pages.
<p>
This page is just to demonstrate linking to other local pages, and to test JavaScript stuff.
<p
align=
'center'
>
<button
type=
'button'
class=
'btn'
align=
'center'
style=
'height:30px; width:70px'
onclick=
'toggleLED()'
>
Toggle
</button>
</p>
<BR><BR><BR>
Send questions to
<a
href=
"mailto:supporrt@emacinc.com"
>
support@emacinc.com
</a>
.
<HR>
<a
href=
"index.html"
>
Home
</a>
<script>
function
toggleLED
()
{
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
"
POST
"
,
"
/led_control
"
,
true
);
xhr
.
setRequestHeader
(
'
Content-Type
'
,
'
application/json
'
);
xhr
.
send
(
JSON
.
stringify
({
number
:
1
,
action
:
'
toggle
'
}));
};
</script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment