Hi everybody,

In my project i am using ajax and jquery. After going to a page via ajax without page reload i want to see the same page if the user refresh the browser. I used the cookie plugin inorder to solve. As it is not safe i am trying to do the same using session. I have dowloaded the jquery session plugin and initialized the session variable using the below satements.

var SESSION_URL = $.session("current_url",Url);
var SESSION_DATASTRING = $.session("dataString",dataString);

and i am getting the session value in the same jquery $(function) where it is initialised, through alert($.session("current_url");

But i am not getting this session value in an another jquery event like

window.load(function(){
});

How can i get the initialized session value in an another event.

Please help me. Thanks in advance.

Jino.

window.load(function(){...});

are you actually using window.load??? Perhaps you meant window.onload? Other than that, I don't see the need to use window.onload directly. If on line 1 you set up a window.onload call and then later on line 100 you do so again, you may be overwriting the "scheduled" event from line 1. jquery handles these types of problems for you internally. So, instead of using window.onload, you can keep using $(function(){...}) as many times as you need and jquery will handle any potential "collisions".

Thanks for ur information. But the problem here is not that. I need to get the session value in anywhere in that js page, that i initialized in an onclick event.

I had tried $.session("current_url"); but it says undefined value.

Assuming you are using the plugin described here:
http://www.ohloh.net/p/jquery-session

it says:

Know Issue- Vars are lost in the page is open in another window or tab. - Objects with functions can't be stored - Window.name is lost - Only Strings can be stored

Does this apply to you? Do you have a sample page that I can see?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.