I have a variable in PHP code which I want to access in my JavaScript function. Below is my code.
myfile.php
<?php
$i = 0;
?>
<html>
<head>
<script type="text/javascript">
function SetText() {
//I want to access value of i here
//alert(i);
}
</script>
</head>
<body>
<button type="button" id="mybutton" onclick="SetText()">Click ME</button>
</body>
</html>
What are the ways to access I variable declared in php code in the JavaScript code?