Answers for "php to call javascript function"

PHP
1

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
Posted by: Guest on March-04-2020
1

call php function in js

<script>
  var phpadd= <?php echo add(1,2);?> //call the php add function
  var phpmult= <?php echo mult(1,2);?> //call the php mult function
  var phpdivide= <?php echo divide(1,2);?> //call the php divide function
</script>
Posted by: Guest on April-07-2020
0

php to call javascript function

echo '<script type="text/javascript">',
     'jsfunction();',
     '</script>'
;
Posted by: Guest on October-03-2021
-2

how to call js function from php

<?php
 if(your condition){
     echo "<script> window.onload = function() {
     yourJavascriptFunction(param1, param2);
 }; </script>";
?>
Posted by: Guest on June-08-2020

Code answers related to "php to call javascript function"

Browse Popular Code Answers by Language