ESP8266 nodemcu controle LED with html on my computer

Hi,
could anybody explain me how to controle the ESP's built in LEDs (pin 2 and 16) with a html file on my computer?

this is my code:

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
ESP8266WebServer server;

char* ssid = "SSID";
char* password = "PASSWORD";

void setup (){
pinMode(2, OUTPUT); //Setup the LEDs
pinMode(16, OUTPUT);
digitalWrite(2, HIGH);
digitalWrite(16,HIGH);
WiFi.mode(WIFI_STA); //Setup the WiFi mode
WiFi.begin(ssid, password); //Connct to WiFi
Serial.begin(115200);
while(WiFi.status()!=WL_CONNECTED){Serial.print(".");
delay(500);}
Serial.println("");
Serial.print("IP Adress: ");
Serial.print(WiFi.localIP());

server.on("/", { //Server on "WiFi.localIP/"
server.send(200, "text/plain", "Hello World!");
});

server.on("/toggle1", toggleLED2); //Server on "WiFi.localIP/toggle1"
server.begin();

server.on("/toggle2", toggleLED16); // Server on "WiFi.localIP/toggle2"
server.begin();

}
void loop(){
server.handleClient();
}
void toggleLED2(){
digitalWrite(2, !digitalRead(2));
server.send(200, "text/plain", "switched LED 2");
Serial.print(digitalRead(2));
}
void toggleLED16(){
digitalWrite(16, !digitalRead(16));
server.send(200, "text/plain", "switched LED 16");
Serial.print(digitalRead(16));
}

The below might get you started.

In this tutorial they are using to esp to serv the website with the html file to the client.
What I want is to have a html/php file on my computer wich allows me to simply send a (empty) post/get request to the esp and trigger the "server.handleClient();".

My problem is that I couldn't figure out how to "ping" the esp without opening a new tab in my browser.

"What I want is to have a html/php file on my computer wich allows me to simply send a (empty) post/get request to the esp and trigger the "server.handleClient();"."

Well, you should be able to do that by using a web page and have the server just send back to the browser status 204 instead of status 200 and a web page.

Sending 202 to "submit" the connection will open a new (empty) tab too.
I've found a solution my self by using JavaScript:

LED2 (it's necessary to send back 202 on the esp's side. Else the script will change the state of the LED every 4 seconds)

My only question that is left is what the "true/false" parameter ("xhr.open'...', '...', true/false") does.

Thanks alot for your help