Esp32 - Ajax webpage with dropdown

Hiya all!

For my project i would need to host a webpage on the esp32 that refreshes its content using ajax (so no refresh of the whole page.) it should also be able to send data back from the webpage, so when a dropdown changes value, it should be written to a variable on the ESP. Another requirement is that it does not use external javascript or css since the esp will be running under ground and have no internet connection. Everything that is needed should be inside the esp. So far I was able to run the sample in the link below, and its working. so it is loading data from the analog input and displaying it realtime on the webpage. But i cannot figure out how to send data back from a dropdown inside the html file.. could somebody please show me how to send data back? maybe by editing the sample in the link so It is easier for me to follow?

Thank you!

Nobody? I was able in the emeantime to run a function on the esp32 when i press a button on the webpage, but still cant pass on a variable

you need to set up a basic webserver, to provide basic script files if you need to run off non web connected net
note server has to provide this file jquery.min.js
example here

sample script showing simple Post method off grid

<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script src="http://10.0.0.127/jquery.min.js"></script>
</head>
  <body >

      <button id="auto" onclick="sinfo()">Info</button>
     
    
  </body>
</html>
<script type="text/javascript">


    function   sinfo(){
        var settings = {
            "url": "http://10.0.0.127:8081/zeroconf/info",
            "method": "POST",
            "timeout": 0,
            "headers": {
                "Content-Type": "application/json",
                "Accept":"*/*"
            },
            "data": JSON.stringify({ "deviceid": "", "data": {} }),
        };

        $.ajax(settings).done(function (response) {
            console.log(response);
        });
    }
</script>

type or paste code here

server callback

void vinf() {
  int sig = WiFi.RSSI();
  String gd = "{\"data\": {\"switch\":";
  if (smode)
    gd += "\"on\"";
  else
    gd += "\"off\"";
  gd += ",\"pulse\": \"off\",\"pulseWidth\": 0,\"deviceid\": \"" + devid + "\",\"signalStrength\":";
  gd+=sig;
  gd+="}}";
  server.sendHeader("Access-Control-Allow-Origin", "*");
  server.sendHeader("Access-control-allow-headers", "Authorization, Content-Type,x-requested-with");
  server.sendHeader("Access-control-allow-methods", "GET,PUT,HEAD");
  server.sendHeader("Content-Type", " application/json");
  server.send(200, "application/json", gd);
}