如何通过codeigniter中的jquery获取cookie?

iam debugging an application which sets cookie via jquery.

$.cookie("cookie_name",'s',{ path: '/'});

how can i fetch the cookie from codeigniter.?

$this->input->cookie('cookie_name', TRUE);

is not returning anything. please help.

Check you have loaded cookie helper like,

$this->load->helper('cookie');

before using it.

If you loaded it then try this print_r($_COOKIE); to check whether your cookie is set or not.

Read http://ellislab.com/codeigniter/user-guide/helpers/cookie_helper.html

You have to use this jquery plugin there is also brief documentation how to use it. by this you create, delete and edit cookie with jquery itself .

Also refer this answer and on server side you can use normal codeigniter cookie function it works fine for me.

Or you can add cookie helper to autolod -> applications/config/autoload.php

$autoload['helper'] = array('cookie');

if you use autoload you don`t need to load it manualy each time when you need it!

$this->load->helper('cookie');

Simple

$.cookie('the_cookie');

the issue solved out . i tried to add cookie via jquery which has different encryption from codeigniter. the issue solved out when i tried to using normal $_COOKIE[] . there i eliminated encryption issue.