469 posts
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has sold $250,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
SaurabhSharma says

For example, I have two copies of a page; both of which contain same jquery code. Something like:

$(document).ready(function () {
    var flag = 0;
    $('#anchor').click(function () {
        flag = 1;
    });
})

When I am on Page1 and clicked #anchor, the flag value changed to 1. Now if I return to Page2, I need the flag value to get modified, depending upon the action performed on Page 1; and vice versa. i.e. Modifying a variable on one page should update itself globally for all pages. How can this be done?

Any help is most appreciated. Thanks in advance

2329 posts
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Helped several times protecting Envato Market against copyright violations
+6 more
CreativeMilk says

Use a cookie(use and not eat ;))

450 posts Don't be a HATER!
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+5 more
webinpixels says
Use a cookie(use and not eat ;))

+1 :D

469 posts
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has sold $250,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
SaurabhSharma says
Use a cookie(use and not eat ;))

Thanks Mark. I will try with that. :)

2529 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Interviewed on an Envato blog
+11 more
JeffreyWay says

Or – if it isn’t sensitive data, you can pass it through the query string.

But yeah – setting a cookie is probably the easiest method.

469 posts
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has sold $250,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
SaurabhSharma says
Or – if it isn’t sensitive data, you can pass it through the query string. But yeah – setting a cookie is probably the easiest method.

Thanks Jeff. I had this done successfully with cookies and jquery cookie plugin. :)

by
by
by
by
by
by