Calling Php Function From Javascript Code Example


Example 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

Example 2: 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>

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable