Answers for "pass php variable to js"

PHP
10

javascript php variable

<script type="text/javascript">
   var php_var = "<?php echo $php_var; ?>";
</script>
Posted by: Guest on March-20-2020
5

js var to php

<script>
   var res = "success";
</script>
<?php
   echo "<script>document.writeln(res);</script>";
?>
Posted by: Guest on February-10-2020
8

php pass a variabele to js

<script>
'var name = <?php echo json_encode($name); ?>;
</script>'
Posted by: Guest on February-08-2020
6

pass php variable to javascript

//passing PHP variable to JavaScript
var myJSVar = <?php echo json_encode($myPHPVar); ?>;
Posted by: Guest on August-05-2019

Code answers related to "pass php variable to js"

Browse Popular Code Answers by Language