title: how to use javascript variable inside php in javascript function
body: <p>I'm using JavaScript to redirect a page with dynamic parameter.</p>
  
  <p>Here is the code, I had to use the PHP function inside JavaScript. It works but it isn't using the javascipt variable</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var $map = jQuery.noConflict();
         $map(document).ready(function(){
              $map("#map_search").click(function(){
                    var staffname = $map("#staffname").val();//alert(staffname);
  
                    var from = $map("#cdate_from").val();
                    var to = "&lt;?php echo site_Encryption(from); ?&gt;";alert(to);
                    var status = $map("#status").val();
                    window.location = "http://localhost/staff/booking.php?date="+to+"&amp;tdate="+to;
  
  
  var to = "&lt;?php echo site_Encryption(from); ?&gt;";alert(to);
  </code></pre>
  
  <p>Here I use the PHP function and "from" is JavaScript variable that I want to use.</p>