Good people, it turns out that I have a theme, I'm doing an interface to control an arduino that I have, and what I did was with JavaScript send a GET request when you press the power button and another by pressing the power off button, which I want to use a checkbox
and that when selecting it the function on()
is executed and when you select it the function off()
<script type="text/javascript">
function on2() {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var url = "http://192.168.0.104/r2=ON";
xmlhttp.open("GET", url, false);
xmlhttp.send(null);
var respo= xmlhttp.responseText;
}
function off2() {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var url = "http://192.168.0.104/r2=OFF";
xmlhttp.open("GET", url, false);
xmlhttp.send(null);
var respo= xmlhttp.responseText;
}
</script>