how to run javascript function from php code example
Example: call javascript function from php
// The most basic method
<?php
echo '<script type="text/javascript">',
'someJsFunc();', // Or Whatever
'</script>';
?>
// However, if what you are trying to achieve requires more complexity,
// You might be better off adding the V8JS module, see link below