title: Accessing codeigniter session variables inside javascript
body: <p>How to access codeigniter session variables inside javascript? If I create session variable inside plain php and access it in javascript it gives me result but in case of codeigniter session variables it gives me syntax error.</p>
  
  <p>I use following code of line to access codeigniter session variable in my .js file </p>
  
  <pre><code>var m1  = "&lt;?php echo json_encode($this-&gt;session-&gt;userdata('max_age')); ?&gt;";
  </code></pre>