Hi all I might be way off so please let me know if there is a better way, but I have is some tasmoto sonoff devices and I have this link of code on a button to toggle the light on and off
http://192.168.1.126/cm?cmnd=Power%20toggle'" />
now when I do that I get the output from the command I guess I wouldn't mind the output as a status to know what the light is doing as I would like to show that as well but the output is shown on a different page so I can't use this on a screen as a button yet
HTML code I know its wrong how do I fix it, please
    <html>
    <body>
    <form>
        <input class="MyButton" type="button" value="Office Toggle" onclick="window.location.href='http://192.168.1.126/cm?cmnd=Power%20toggle'" />
        <br>
        <input class="MyButton" type="button" value="Fishtank Toggle" onclick="window.location.href='http://192.168.1.128/cm?cmnd=Power%20toggle'" />
    </form>
}
    </body>
        function togglelight() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      console.log(this.responseText); //To check output while error[Optional]
    }
  };
  xhttp.open("GET", "http://192.168.1.126/cm?cmnd=Power%20toggle", true);
  xhttp.send();
    </html>
 
     
     
     
     
    