getSession

(since )



Retrieves a value from the session on the APE server.

Description


string getSession ( mixed key, [function callback] )

Retrieves a value from the session on the APE server.

Parameters


key
A string if you just need to get on key. An array of key if you want to get multiple key in one request.

callback
Callback function to execute when the sessions is received. One arguments is passed to the callback function with the response of the server.

Examples


//ape var is a reference to APE instance
 
ape.setSession({'myKey1':'myValue','myKey2':'myValue2'});
 
ape.getSession('myKey', function(resp) {
        console.log(resp.datas.sessions.myKey);
});

//ape var is a reference to APE instance
 
ape.setSession({'myKey':'["A Json array", "Value 2"]'});
 
ape.getSession('myKey', function(resp) {
    //decode the received data, and use eval to dedode the data
    console.log(eval(decodeURIComponent(resp.datas.sessions.myKey)));
});

See also


User notes


fabian
fabian said:
resp.datas.sessions.myKey is wrong

it must be resp.data.sessions.myKey

data not datas
28/04/10 12:08

Adrian
Adrian said:
How to get/set session values on the server side? is this possible? But to clear the session on the server side?
I think there is some missing documentation about session handling on the server side!
Thanks!
11/05/10 11:32

Post a note


User notes may be edited or deleted, and usually a note is deleted because of the following reasons:
  • Bugs: Instead report a bug
  • Missing documentation: report that as a bug.
  • Support questions: See the community for available options.

In other words, do not ask questions within the user notes.

Note <b>,<u>,<i> HTML tags are allowed in the posts and the note formatting is preserved. URLs will be turned into clickable links, JavaScipt and C code blocks enclosed in the <source="javascript">JS Code</source> and <source="c">C Code</source> tags will be source highlighted automatically.