Skip to content

Instantly share code, notes, and snippets.

@RuiSantosdotme
Created March 17, 2019 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RuiSantosdotme/0245af5b6566babceb807bf799a27045 to your computer and use it in GitHub Desktop.
Save RuiSantosdotme/0245af5b6566babceb807bf799a27045 to your computer and use it in GitHub Desktop.
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}
.button { background-color: #31B404; border: none; color: white; padding: 16px 40px; text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}
.button2 {background-color: #DF0101;}
.button3 {background-color: #31B404;}
.button4 {background-color: #DF0101;}
</style>
<script>
function outputOn() {
var xhr = new XMLHttpRequest();
xhr.open('GET', "/5/on", true);
xhr.send();
location.reload(true);
}
function outputOff() {
var xhr = new XMLHttpRequest();
xhr.open('GET', "/5/off", true);
xhr.send();
location.reload(true);
}
</script>
</head><body>
<body><h1>ESP8266 Web Server Garage</h1>
<p><button class="button" onclick="outputOn(this)">ON</button></p>
<p><button class="button button2" onclick="outputOff(this)">OFF</button></p>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment