Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Problem Session Ajax
  • Hello everyone,

    I'm using session cookie in my application and is running finebe working normally, but when I used call ajax the data return null. What do I do wrong?

    Regards,

    Diego.
  • more context would be nice.

    PS. do you use \Form::csrf() in your forms? If so, did you updated your CSRF-token before sending an ajax call ?
  • My context is very simple.
    Controller_Index extends Controller_Template
       action_index
            Session::set('test',1);

    When I go to use in another place (via ajax) it return null.
    Controller_Api extends Controller_Rest
       get_test
           return Session::get('test'); // return NULL

    I was doing debugging the code the cookie always auto-inicialization when I use functions ajax. But when I used 'db' instead of the 'cookie', the code running fine.
  • Very odd, because no matter what session store you define, the cookie will always be created. And it is the same code that does that. Only difference is whether or not in contains the session payload.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion