I have some JavaScript code in webpage.php. Part of the JS code is generated by PHP. I want to move the JS to a different file, jscode.js. How can I move the PHP-generated JS code out of webpage.php in such a way that webpage.php still dynamically loads JS code, according to variables declared in webpage.php?
Part of webpage.php looks like this:
<?PHP $height = $_POST['height'];
// more code
var height = <?PHP echo $height; ?>;
I want it out of the document where $height is declared. How do I do this?