ESP32 web server display

Hello,

I'm currently trying to read data from ESP32 ADC, and display them on a web server that I've created.
The thing is that the sending take too much time. I don't know if it is because of my Arduino web server code, the XMLHttpRequest or my HTML code.

Here find the links to my GitHub project:

I will take all the help you can give me.

Thanks in advance.

Do you see if the the XMLHTTPRequest is sent? Usually you supply an URL there not just a string, although it might even work as the defaults are luckily set to match your expectations. What does the browser tells you? What result code do you get?

Hello,

Yes my request is send. The issue is that when I use : setInterval(mainFunction, 1000); wich normaly does my MainFunction every 1sec, i get an answer between 1 to 10 sec or more.

I don't understand why..

I'll update my code on GitHub - LamboulCorentin/esp32_webserver_display: Esp32 web server with Ajax request to display values from esp32 ADC

server.send(200, "text/plane", adcValue); //Send ADC value only to client ajax request

The correct mime type for simple text is "text/plain".

The issue is that when I use : setInterval(mainFunction, 1000); wich normaly does my MainFunction every 1sec, i get an answer between 1 to 10 sec or more.

It seems you're doing that over you mobile phone and not a home WiFi router or something similar. Don't expect mobile networks to be reliable. Connect your device you WiFi router that is connected by a fixed network to your PC. Then do the tests on the PC. Once you got that running you can start experimenting with mobile stuff.