0

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

Dynamite Media
  • 159
  • 2
  • 10

1 Answers1

1

If your page is .html then will probably not run php on it. Rename to index.php and let me know.

zJorge
  • 798
  • 2
  • 13
  • 26