title: Print a javascript variable in php
body: <p>I am selecting a payment method and making an AJAX call But I am not able to print the <code>paymentOption</code> parameter</p>
  
  <p>I tried storing it in a cookie </p>
  
  <pre><code>if(paymentOption == "default_cod"){
              processOrderWithCOD();
              optionPayment = Cash;
          }
  document.cookie = "$payment_option = $this.optionPayment";
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php 
                  $paymentOptionDisplay =  $_COOKIE['payment_option'];
                  echo $paymentOptionDisplay ?&gt;
  </code></pre>
  
  <p>I am just trying to print paymentOption but later on its value is changed so need to save it and print</p>