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

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -