This page is a index.html page with javascript in it.
Here is what i am using:
<script>
$(document).ready(function(){
var balance ="<?php echo json_encode($balance, JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP); ?>";
console.log(balance)
All the console is showing is this:
<?php echo json_encode($balance, JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP); ?>
I have also tried this, since I'm not sure if all those JSON tags are necessary:
var balance ="<?php echo json_encode($balance); ?>";
But it still wont work and just shows up exactly like the others in console:
var balance ="<?php echo "45";); ?>";
Edit: I did not say it was echoing on page but in the console. its a flash file so nothing but the flash was showing on the page. I thought this was a javascript issue i will try the solution below. That other answer may help cause i had not thought of that. Thanks for the solution but i believe this is not the same question