Created
September 12, 2020 07:03
-
-
Save toygame/e279b65ad2d713519044bea5cf3dd0eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><%= title %></title> | |
<link rel="stylesheet" href="/stylesheets/style.css" /> | |
</head> | |
<body> | |
<h1><%= title %></h1> | |
<p>Welcome nodejs-tasmota</p> | |
<button id="butt_on">เปิด</button> | |
<button id="butt_off">ปิด</button> | |
</body> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | |
<script> | |
$("#butt_on").click(function (event) { | |
event.preventDefault(); | |
$.get("/control/on", function (data, status) { | |
alert("Data: " + data + "\nStatus: " + status); | |
}); | |
}); | |
$("#butt_off").click(function (event) { | |
event.preventDefault(); | |
$.get("/control/off", function (data, status) { | |
alert("Data: " + data + "\nStatus: " + status); | |
}); | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment