Under what conditions can I put PHP into Javascript code? Is it always ok? Is it just a bad idea? I am surprised I have not seen it more.
For example, I came across this..
$('#thumbnail').imgAreaSelect({aspectRatio: '<?php echo $thumb_height/$thumb_width;?>', onSelectChange:preview});
..which was in an onpage script element. I'm not so experienced, but I was just surprised that I had never seen mixed js/php before. But can you put PHP in .js files as well? If I set the file extension to .php, will the file be parsed?