javascript - Declare variable in php file that will access in JS/jQuery -
how can declare global variable in php
file , access directly in jquery
?
html
<script type="text/javascript"> var date_selected = <?php echo $from; ?>; </script>
js
$(function() { alert("dsdsadasdas" + date_selected); var date = date_selected; var startdate; var enddate; });
because on test not working.
you missing quotes
var date_selected = '<?php echo $a; ?>';
Comments
Post a Comment