title: Php magento SESSION variables getting unset before executing javascript code inside php
body: <p><strong>I am trying to show pop-up using jQuery inside php code.</strong></p>
  
  <p>setting value to session variable $SESSION['prod_id']="123"</p>
  
  <p>When user is not logged in I am setting some value to session_variable i.e.  and as User get logged in I want to call javascript(inside php code) if value is set for this variable then show pop-up to user and unset the variable from session.</p>
  
  <pre><code>if(Mage::getSingleton('customer/session')-&gt;isLoggedIn()){
      if (isset($_SESSION['prod_id'])) {
           Mage::helper('company/product')-&gt;addDatabase($_SESSION['prod_id']);
           $productName = $session-&gt;getData('product_session');
           if (!empty($productName)){
               echo "&lt;script type='text/javascript'&gt;
               jQuery(document).ready(function(){
                jQuery('.show-toast').removeAttr('style').css('display','block');
                  }); 
              });
                      &lt;/script&gt;"; 
           $session-&gt;unsetData('product_session');    
           unset($_SESSION['prod_id']); 
       }
    }
  }
  </code></pre>
  
  <p>But the problem is that before executing javascript code session variable is getting unset.But if I comment out unset session line then it works fine. </p>