Code: Select all
<?php
$myVariable = "hello";
?>
<script type="text/javascript">
var myVariable = ..... $myVariable;
</script>Moderator: General Moderators
Code: Select all
<?php
$myVariable = "hello";
?>
<script type="text/javascript">
var myVariable = ..... $myVariable;
</script>Code: Select all
<?php
$var = "hello";
?>Code: Select all
<script type="text/javascript">
var newvar = "<?php echo $var; ?>";
</script>Code: Select all
<?php
$myVariable = "hello";
echo "<script type='text/javascript'>";
echo "var myVariable = '$myVariable'";
echo "</script>";
?>