I have a html file:
<body>
<?php
$rand1 = rand(0,10);
$rand2 = rand(0,20);
?>
<span id="client-registration-button">Registration</span>
<script>var checksum = <?php echo $rand1+$rand2; ?>;</script>
<script src="/main.js"></script>
</body>
And in main.js is:
$('#client-registration-button').click(function() {
alert(checksum);
});
But the alert shows no value, just empty alert window. Why is there no value of global variable "checksum" displayed?