In my php script I have variable like below.
$duration = 60;
Now I'm accessing the above PHP variable in javascirpt.
<script type="text/javascript">
var phpVar = '<?php echo $duration; ?>';
console.log(phpVar );
</script>
But in the console I'm getting the whole data instead of 60. That is, output is
'<?php echo $duration; ?>'
Please help me how to access the php variable properly.
Thanks.