Jquery和codeigniter会话

I've looked around, but I can't seem to find a solution.

I have a drop down menu in my html and when you select one of the option it redirects to a different url in my jquery.

like this

$('#chapter').change(function(){
  var chapter = $(this).val();
  $(location).attr('href','http://www.writeyourfiction.com/story/readStory/'+chapter);
}); 

This all works fine, but my issue is when that redirect happens codeigniter seems to be dropping my sessions. I've var_dumped my sessions before the redirect and they are there, but when I ver_dump them again after the redirect the sessions are empty.

Any help would be amazing!

I think so the session class must either be initialized in your controller constructors,by use the $this->load->library('session'); function, Or If sessions data does not exist (or if it has expired) a new session will be created and saved in the cookie.

It is better to load your session library in /application/config/autoload

for jquery with codeigniter drop down you could do something like this i used jQuery Ajax: here is the code example:

<select name="all_users" id="all_users" onchange="javascript:cal_ajax(this.value);">
  <?=$my_option_list?>
</select>

<script type="text/javascript">
var base_url = '<?=base_url()?>';

function cal_ajax(id)
{ 
    $.ajax({
    type:"POST",
    url: base_url+"history/home/get_users",
    data: "userid=" + id,
    success: function(result){
        $("#Mehdi_ajax").html(result);
    }
    });

}
</script>

in our controller function for example here in function get_users() you set your redirections