I know it is not possible to simply call a function through ajax. As it only sends data via HTTP headers. However, I am trying to achieve something. I'm trying to execute a piece of PHP code, by the click of a button. The code consists of a shell_exec("omxplayer file.mp3")
So my ultimate goal is, to have a page load, display a button, which in turn, once clicked, will execute this piece of code (shell command).
I have looked for solutions and have not found one, even though there have been a lot of questions asked with a similar title to mine.
How can I achieve this concept?
EDIT: My ultimate goal is to use the shell_exec()
to start playing a file using omxplayer on a linux machine.