I have an php variable contains string, got from a function, and wants to view it in alert message in javascript, well, I tried to that
var tmp='<?php echo $BillMsg; ?>';
alert(tmp);
But the alert didn't show up, in the console I found this error Uncaught SyntaxError: Unexpected token ILLEGAL
I tried to define a random php variable like the follwoing
<?php $test="test";?>
<script> alert(<?php echo $test; ?>); </script>
It works fine, but when using the variable $BillMsg, it won't work? Whats wrong?