title: how to get php session value in javascript file
body: <p>i have a php file in which i am calling external takeatour.js file 
  in that js file i want php session data.by using a code....</p>
  
  <pre><code>$(this).ready(function() {
  
      var category = &lt;?php echo json_encode($this-&gt;session-&gt;userdata('category')); ?&gt;;     
     alert("category="+category);
  });
  </code></pre>
  
  <p>is it correct??
  plz give me some suggestion.
  Thanks!!</p>