0

The GeekTechesNC1601 is a 16 output controller capable of turning on or off devices based upon a URL. I have some basic HTML code similar to this:

< button onclick="location.href='http://192.168.5.31/30000/01'" type="button"> Relay-1 On</ button>

< button onclick="location.href='http://192.168.5.31/30000/00'" type="button"> Relay-1 Off</ button>

The problem is, however, on each click on the button, it takes me to the page of the device. Not exactly what I want to do. I need it to perform the function, but stay on the webpage I'm creating with the buttons.

Is there an easy way to do this?

Wally
  • 1
  • Have you tried this solution ? [How to click a link that will execute but not redirect.](https://stackoverflow.com/questions/29079539/how-to-click-a-link-that-will-execute-but-not-redirect) – Marek Prymula Dec 07 '20 at 12:31
  • Ok, found a fix that works quite well: https://stackoverflow.com/questions/45697176/send-simple-http-request-with-html-submit-button I have added a second button - works perfectly! – Wally Dec 09 '20 at 10:37

0 Answers0