Okay, so the idea is that I need a piece of javascript to run once an if statement in php has been met however this needs interaction with the dom, so assume a button being pressed and a variable has been passed to the php on button press. (It isn't that senario but fairly similar):
if ($button == 1){
echo '<script type="text/javascript"> document.getElementById("myForm").submit(); </script>';
}
And I want once this condition is met for this code to run. It needs to be within the php if statement I can't move it to js. However I did think about trying to add the code into a variable and passing that variable to the js via ajax but didn't work.
Any help would be much appreciated.