Commit a539f68f authored by Klint Youngmeyer's avatar Klint Youngmeyer
Browse files

Add button and javascript function to page2 to toggle LED, using 'REST' API

parent 89bbbcdf
......@@ -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>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment