The Python script is also working if i execute it from the terminal and it doesnt need any input data nor does it create output data, it should just controll the GPIOs
My RaspberryPi is not the Webserver, it is only connecting to it via browser.
Update: Got it to work thanks to the help in the answer, but now I am facing the next issue. I use an AJAX request to start my Python script controlling the LEDs, the routine takes 15 seconds until it is done. I want to be able to stop the LED-routine by pressing a button that is on the same webpage. I already tried
but it doesn't work in this case(or at least not how I am using it).
I also tried making a second webpage from the server on the Raspberry Pi and then access it with another AJAX request. The second page starts a script that turns off the LEDs. Currently I am not able to access the second page until the first one is done with the routine.