I am trying to parse an int value from php into a javascript variable but it is not working.
The first alert correctly displays the int value, but the second says “undefined”. How can you parse the php variable correctly into the variable “test” as an integer? I tried parseInt but it didn’t work. The value is for a graph so I need to at some point use the fillRect() command, the alerts are for testing only. Thanks.
alert('<?php echo( $graph_max_max_value ); ?>');
var test = <?php $graph_max_max_value; ?>
alert(test);
var test = <?php echo $graph_max_max_value; ?>;should work.This outputs using
echo, which you forgot, and adds the statement terminating semi-colon at the end.