Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #variable #javascript #file
ADD COMMENT
Topic
Name
6+9 =