Transfer value from html button onmousedown event to ESP8266 value

Hello,
i have question i will transfer a button event value on html too a value for ESP8266. So when i push the html-button then the motor should spinning and when i release the html-button the motor should stop spinning(onmousedown event)

PS. See attachment for my arduino sketch

Greets,

Marc

ControllingServoFromBrowser.ino (1.5 KB)

function Forward() {
    var xhr = new XMLHttpRequest();
    xhr.onerror = function(e) {
      alert(xhr.status + " " + xhr.statusText);
    }
    xhr.onload = function(e) {
    };
    xhr.open("GET", "/Forward", true);
    xhr.send();
}

thanks, but how can i convert the sent value from xhr in a arduino ide integer or boolean, so that i can say if (val == "1") then motor will spin?

you register an "on" handler to the webserver for "/Forward"

  server.on ( "/Forward", handleForward );

thank you i have another question about an scroll bar for the steering, the question is how to get an variable that is changing from the scroll bar. Do you also have an method that de requests doesnt crash through so much requests.

PS. in the attachment the updated project file

BestuurbareLegoAutoDefinitief.ino (2.29 KB)

marc1200:
thank you i have another question about an scroll bar for the steering, the question is how to get an variable that is changing from the scroll bar. Do you also have an method that de requests doesnt crash through so much requests.

PS. in the attachment the updated project file

you want to control a RC car over web? that must be a very slow car

do not send every change. code it in js so that the next request is sent only when the previous returned

yes, i have an bluetooth module zo i can control it with bluetooth, is bluetooth faster then wifi, or set the esp8266 as an AP so that i can connect with my smartphone to the wifi network of the esp8266? what i want is when i push the button the car will drive when i release the button then the cars stops, but with wifi the xhr gaves errors how can that, i can only push once en then the car drive but when i push another button xhr gaves only errors.

WiFi is fast, but HTTP and HTML is not suitable for realtime control.