Ajax and Session loss |
[eluser]kenjis[/eluser]
CI's default 5 min session updating can cause session loss when more than 2 requests come at the same time, most of cases with Ajax calls. Many people get stuck to this issue. http://ellislab.com/forums/viewthread/167310/ http://ellislab.com/forums/viewthread/102456/ How about stopping session update in case Ajax call? Code: --- a/system/libraries/Session.php Tue Sep 14 18:45:42 2010 -0500 Note: You need to send X_REQUESTED_WITH header manually if you use jQuery or so.
[eluser]InsiteFX[/eluser]
Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); InsiteFX
[eluser]kenjis[/eluser]
My proposal is to fix CodeIgniter Session Class, not to extend it.
[eluser]CroNiX[/eluser]
And having the profiler enabled destroys just about any and all ajax because it always appends the profiler html along with the output from any request made to that controller/method.
[eluser]InsiteFX[/eluser]
Ok sorry, that's what happens when your on the web all day... InsiteFX
[eluser]cyrigniter[/eluser]
hi, i'm digging this post up cause I have the very same issue (session loss due to ajax calls) I didn't get the workaround : i should hard hack the CI session class ? there is no better way ? EDIT : totally fixed InsiteFX's workaround is good (I just defined a IS_AJAX constant in constants.php instead of using IS_AJAX() function which I don't know about)
[eluser]kenjis[/eluser]
patch to current ci tip: Code: diff -r 0bff9acdc441 system/libraries/Session.php |
Welcome Guest, Not a member yet? Register Sign In |