To access a PHP variable from Javascript, simple you PHP code to echo it as following.
var my_javascript_variable=<?php echo $MY_PHP_VARIABLE;?>