Welcome Guest, Not a member yet? Register   Sign In
Sessions and jQuery .load
#1

[eluser]MgM Web[/eluser]
I'm using CI 1.7.0 with database sessions. Lately I have had problems with my session variables. At one page I successfully start the session and add some data to the session. Everything works, I close the browser and open it again, session data is still there.

The problem occurs when i browse to a page using jQuery to load content of a view into an DIV.

$("#div").load("/root/mypage");

This is working, the external content is loaded into the div, but whenever I browse to this page all my session data is lost.

I have been using cookie sessions before and this was not a problem when using cookies. Does anyone know how this can happen and what to do?
#2

[eluser]MgM Web[/eluser]
Anyone with the same problem?
#3

[eluser]johnwbaxter[/eluser]
Are you using jquery cookies as well as CI cookies?
#4

[eluser]MgM Web[/eluser]
No, as far as I know I do not use jQuery cookies. And im not using CI cookies im using database to store sessions. When I use CI cookies everything is working as it should, the problem occurs only when im using database sessions and only when I browse to a page using the jQuery .load function to insert content into an div.
#5

[eluser]johnwbaxter[/eluser]
If you're storing session info in the db you are still using a cookie obviously, just with only a little bit of data in there.

Are you using any plugins with jquery?
#6

[eluser]MgM Web[/eluser]
jquery.js, jquery.form.js, jquery.jqModal.js, jquery.validate.js, jquery.ui.datepicker.js, jquery.hint.js, jquery.ui.core.js, jquery.ui.tabs.js.

These are the jQuery components im using.
#7

[eluser]MgM Web[/eluser]
My config:

$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = True;
$config['sess_table_name'] = 'Sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
#8

[eluser]johnwbaxter[/eluser]
Have you got a url i can try? You can PM if you'd rather not put it on the board.
#9

[eluser]MgM Web[/eluser]
Hi, I have researched some more. I still get this error in FF3 but it is working ok in IE7.

When I browse using IE7 I can see in the DB that 1 record is inserted in the session table:

086c1abdcfd2fd799cf35624095ab745
xxx.xx.xxx.xx
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; 1227715799
a:1:{s:8:“language”;s:7:“english”;}

And it remains 1 record throughout the booking session.

When I try using FF3 there is one record created until I browse to http://midtli.minferie.no/Reservasjon. When I get to that page I can see in the DB that 1 more record is inserted, so there is 2 records representing the same user agent.

abf9468edcc6ac39b21d2e3f9e017536
xxx.xx.xxx.xx
Mozilla/5.0 (Windows; U; Windows NT 6.0; nb-NO; rv 1227716212

24e47777daec3f61778ddbf5b45ee964
xxx.xx.xxx.xx
Mozilla/5.0 (Windows; U; Windows NT 6.0; nb-NO; rv 1227716209
a:1:{s:8:“language”;s:7:“english”;}

I think this is the problem, maybe it is created a new session whenever I load the content of the other view into one of the div’s on the page.

Im using CI 1.7.0 and native CI DB-session handlers, strange is that I do not get this problem when using cookie based sessions.




Theme © iAndrew 2016 - Forum software by © MyBB