Reputation: 71
I have a jQuery function that counts the number of images (eg. 3 images) in a gallery.
var imageNumber = $(".ox-images-gallery img").length; //value=3
How can I pass the value of imageNumber
from the current page to another page using jQuery or Javascript?
I tried with:
Page 1
localStorage.setItem('val',imageNumber)
and
Page 2
localStorage.getItem('val');
but the problem is I must go to page 1 first so that the correct value of imageNumber
is displayed on page 2. Any other approaches to do this?
Thanks.
Upvotes: 0
Views: 103
Reputation: 213
//save a value
sessionStorage.setItem("name", "Nicholas");
//retrieve item
var name = sessionStorage.getItem("name");
Upvotes: 1