Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I create session in jquery?

Here is my code. jquery.session.js file is also loaded I could not get where is the problem. Can you Please tell me the solution.

$.session.set('rmng_time', remaining_seconds);
        alert("j session  "+$.session.get('rmng_time'));

this code gives an error in console TypeError: $.session is undefined

like image 655
Aasiya Mairaj Avatar asked Jul 13 '16 06:07

Aasiya Mairaj


1 Answers

You need to reffer this tutorial:

http://phprocks.letsnurture.com/create-session-with-jquery/

Add required files and refer code -

jquery-1.9.1.js and jquery.session.js

ex.

To set session:

$(function() {
 $.session.set("myVar", "Hello World!");
});

To get session:

alert($.session.get("myVar"));
like image 121
Dhara Parmar Avatar answered Sep 25 '22 16:09

Dhara Parmar