Accessing codeigniter session variables inside javascript
How to access codeigniter session variables inside java script? If i create session variable inside plain php and access it in javas cript it gives me result but in case of codeigniter session variables it gives me syntax error. I use following code of line to access codeigniter session variable in my .js file 

var m1  = "<?php echo json_encode($this->session->userdata('max_age')); ?>";
Accessing codeigniter session variables inside javascript
===

How to access codeigniter session variables inside java script? If i create session variable inside plain php and access it in javas cript it gives me result but in case of codeigniter session variables it gives me syntax error. I use following code of line to access codeigniter session variable in my .js file 

var m1  = "<?php echo json_encode($this->session->userdata('max_age')); ?>";