Friday 15 July 2011

php - Laravel Ajax and Session issue? -



php - Laravel Ajax and Session issue? -

i have ajax phone call fires right when dom has finished loading, yet trying prevent situation when user hits refresh , fires ajax phone call 1 time again storing session variable. yet, there seems issue storing session entry via ajax request, consider next snippet:

<?php function postmyajax() { $already_fired = \session::get('ajax_fired'); // <-- returns null! if ( ! empty( $already_fired ) ) { homecoming response::json(array('already fired')); } # remember fired phone call \session::put('ajax_fired',1); // <-- fails set? homecoming response::json(array('ok')); }

any ideas?

for sake of answering question, has been bug since laravel 4.1 session handling becomes unstable on concurrent requests. experienced 1 request made @ time. , there seems no way pinpoint problem.. read here in github issues.

php ajax session laravel

No comments:

Post a Comment