I am currently working on a little project for my PLC. I use PHP to open a connection to said PLC.
I have created a little website to make interacting easier.
What I want to include on this website is a couple of toggles to send different commands to the device.
I want this done without having to reload the website, so what my researches came up with was to use AJAX.
Now I have tried multiple tutorials on AJAX onclick events using normal buttons and toggles....but none of them gave me the results I wanted.
What would be the easiest way to accomplish what I need?
When the button is pressed I need to execute this php code
$plc->WriteBit("E", 0, 0, 0, 1);
When the button is pressed again I need this to execute
$plc->WriteBit("E", 0, 0, 0, 0);
All this should work without reloading the site.
Like I said I have really no clue how to parse this php code directly from AJAX. I hope someone can push me in the correct direction!
Thanks!