How to maintain codegnitor session with AJAX?
My session expires when I call more AJAX requests. So how can I maintain both the AJAX request and the session?
How to maintain codegnitor session with AJAX?
My session expires when I call more AJAX requests. So how can I maintain both the AJAX request and the session?
use this builtin function to check if ajax call or not and then take desired action.
if($this->input->is_ajax_request()){
//action...
}else
{
$this->session->sess_destroy();
}
you can find some answer here CodeIgniter Session Disappear Bug?
your answer also available here Codeigniter session bugging out with ajax calls which is :
class MY_Session extends CI_Session {
public function sess_update()
{
$CI = get_instance();
if ( ! $CI->input->is_ajax_request())
{
parent::sess_update();
}
}
}