Was wondering how i'd go about passing a php variable to my javascript. For example, i have the following code:
How could I go about using a PHP variable to include the "/page.php" instead of having to define it manually for every page I would like to use it on?Code:$("#sort").change(function() { window.location = "/page.php" + $("#sort").val(); });
I've tried a few things but seem to be failing pretty bad lol, for example things like:
and obviously are not workingCode:$("#sort").change(function() { window.location = "<?php echo $page ?>" + $("#sort").val(); });
Any help is greatly appreciated, Thanks!