Hi, i want to make a html page on a raspberry pi to control 3 esp boards for my model train.
The esp's all have buttons to control relay boards. The buttons are html buttons. For each board it works flawless when i give the ip adress from that specific board in the browser.
How can i make those buttons from all 3 esp boards in one html page without the page changing when i click on one button?
The buttons have an url in it.
Edit the "one HTML page" to add the functions you want from the other HTML pages.
Within the URL there must also be a request, hopefully a GET request so you can see what it is.
The ESPs have an IP address each, you include that IP address in the request that you send from the master page.
I am assuming you did not program the ESPs yourself, because otherwise it would be even easier.
instead of one URL for one specific ESP, call a JavaScript Function and let the JavaScript call the 3 ESP URLs
I am not using GET, and indeed i did not programm it myself. I took an example from the internet and made it my own script.
I will try GET and POST to build a new script. Will take some time i guess🤔
Thanks for your help so far👍
You shouldn't need to rewrite the program. The rpi "just" needs to send the url string to the ESP32 like the browser is already doing.
Post an example url for a button.
I'm not 100% sure from your description if this is the case, but if you want to call "foreign" pages from your HTML (meaning that they reside on other servers than yours HTML's domain server (so called cross-origin HTTP requests)), your other servers should give replies to OPTIONS requests and set Access-Control-Allow-Origin header field.
This is how web browsers work but the solution is on the server's side.
I don't know which web server you are using but you'll get the idea what needs to be done from:
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.