Wednesday 12 March 2014

Javascript Session

Javascript Session

You want to send data from one page to another page using javascript.

Then try this

In any page, create Array:

var yourArray = [ 1, 2, 3 ];

Store array in to localStorage
// Store it
localStorage['foo'] = JSON.stringify( yourArray );
Now go to any other page.
use below code
// And retrieve it
var storedArray = JSON.parse( localStorage['foo'] );

now
var a=storedArray[0];

var b=storedArray[1];
var c=storedArray[2];