0

Using ajax function working with sessions. In controller with ajax action i'm setting the session values using $this->session->set('coupons',$data). After setting this session i'm not able to get in another controller file already added session.Can you pls advice me.

public function action_applypcode()
{
        $this->auto_render = false;
        $this->session->set('coupon_details', $restcode);
}

public function action_receipt()
{
       $coupon_details = $this->session->get('coupon_details');
       print_r($coupon_details);
       //Here getting empty session values 
}
sankar muniyappa
  • 356
  • 5
  • 14

1 Answers1

0

What is $restcode?

You shouldn't have any problem on setting session values through ajax or normal request, they work equally, the only diff is that you don't want the layout form ajax calls.

Are you using another lib or module that could initialize a session too? Search in your external modules for $_SESSION, sometimes that can be the problem. If that's the problem, try using Session::instance() at the first line of your template controller.

Btw, I don't remember kohana having an attr for the session in the controllers, also you can try using Session::instance()->set and ->get , maybe that could help too.

Regards!

Yam Frich
  • 77
  • 3