Hello,
I need a help about how can create construction on webpage for changing values that were been using in program.
I don't know which html code for input or read values on webpage. I don't know construction that need for it .
Can you help me please ?
Best regards...
Changing values that were been using in program from Webpage ( please ESP-IDF)
-
- Posts: 5
- Joined: Mon May 10, 2021 10:59 am
-
- Posts: 1700
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Changing values that were been using in program from Webpage ( please ESP-IDF)
You can use HTML forms to take user input and send it to the server.
You can also send data back from JavaScript via XMLHttpRequests.
Values can be sent via "GET", i.e. appended to the URL, or via "POST" as data inside the HTTP request. On the server side, you then extract the data either from the URL's "query parameters" (GET), or read and parse the request body (POST).
You can also send data back from JavaScript via XMLHttpRequests.
Values can be sent via "GET", i.e. appended to the URL, or via "POST" as data inside the HTTP request. On the server side, you then extract the data either from the URL's "query parameters" (GET), or read and parse the request body (POST).
-
- Posts: 5
- Joined: Mon May 10, 2021 10:59 am
Re: Changing values that were been using in program from Webpage ( please ESP-IDF)
Hi MicroController,MicroController wrote: ↑Thu Jun 06, 2024 1:49 pmYou can use HTML forms to take user input and send it to the server.
You can also send data back from JavaScript via XMLHttpRequests.
Values can be sent via "GET", i.e. appended to the URL, or via "POST" as data inside the HTTP request. On the server side, you then extract the data either from the URL's "query parameters" (GET), or read and parse the request body (POST).
Thank you i am looking HTML form .I am reading to understand forms. However, Can you talk about how can take from input to my main program. i think that should use one webpage.html file for use captive portal. I want to use same webpage.html page for inputs ( for example wifi credential or counter values ). i can understand form but how can take date to my main program or show my variable on screen ( for example for radio button variable). what can do essential in my main program for interchanging variable my webpage.html.
Kayip-Adam
Re: Changing values that were been using in program from Webpage ( please ESP-IDF)
I usually use websockets (CONFIG_HTTPD_WS_SUPPORT=y), just register an uri handler for the index.html (HTTP_GET handler, is_websocket=false) and an uri handler to capture the websocket calls (is_websocket = true).
The embedded html page has some basic javascript basic to connect to the esp, using stuff like:
and the handler code on the esp site will use calls like httpd_ws_recv_frame to get the content from the browser/javascript code.
updates from the esp end to html/javascript/browser is done by sending over the websocket, using httpd_queue_work.
When you add jquery to the mix, it is not difficult to create a dynamic page with all variables controlled by the code on your esp.
hth.
The embedded html page has some basic javascript basic to connect to the esp, using stuff like:
Code: Select all
const ws_socket = new WebSocket(`ws://${window.location.host}/ws/`);
...
ws_socket.send(JSON.stringify(o));
updates from the esp end to html/javascript/browser is done by sending over the websocket, using httpd_queue_work.
When you add jquery to the mix, it is not difficult to create a dynamic page with all variables controlled by the code on your esp.
hth.
Who is online
Users browsing this forum: Bing [Bot] and 262 guests