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">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script src=""></script>
  <body >

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

    function   sinfo(){
        var settings = {
            "url": "",
            "method": "POST",
            "timeout": 0,
            "headers": {
                "Content-Type": "application/json",
            "data": JSON.stringify({ "deviceid": "", "data": {} }),

        $.ajax(settings).done(function (response) {

type or paste code here

server callback

void vinf() {
  int sig = WiFi.RSSI();
  String gd = "{\"data\": {\"switch\":";
  if (smode)
    gd += "\"on\"";
    gd += "\"off\"";
  gd += ",\"pulse\": \"off\",\"pulseWidth\": 0,\"deviceid\": \"" + devid + "\",\"signalStrength\":";
  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);