How do I make this work? I've googled and even saw some examples here on Stackoverflow which show this kind of coding, but it doesn't work for me.
<script type="text/javascript">
var infoClass = "";
infoClass = <?php echo('test'); ?>;
alert(infoClass);
</script>
The alert box displays empty box.