javascript and php add php variable as parameter in javascript method code example
Example: javascript access php variable
//passing PHP variable to JavaScript
var myJSVar = <?php echo json_encode($myPHPVar); ?>;
//passing PHP variable to JavaScript
var myJSVar = <?php echo json_encode($myPHPVar); ?>;