Answers for "set php value to javascript variable"

PHP
3

using js variable in php

<script type="text/javascript">
var abc= 'this is text';
<?php $abc = "<script>document.write(abc)</script>"?>   
</script>
<?php echo $abc;?>
Posted by: Guest on June-10-2020
0

how to use php variable in javascript file

<?php
    $color = "Red";
?>
<script type="text/javascript">var color = "<?= $color ?>";</script>
<script type="text/javascript" src="file.js"></script>
Posted by: Guest on October-17-2020

Code answers related to "set php value to javascript variable"

Browse Popular Code Answers by Language