Isn't this how you turn a php var into a js var?
Code:
var url = "<?php echo $_SESSION['url'] ?>";
if so, why does the php code display in an alert() instead of the value of $_SESSION['url']?