I know this is a frequent question on Stack Overflow but I couldn't find scenario where the PHP code is just above JS script in the same file. I guess ajax POST/GET won't do the job in this case?
(...)
var ww = $(window).width();
</script>
<?php $ww = [data here] ?>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…