470 posts
  • Trendsetter
  • Weekly Top Seller
  • Exclusive Author
  • 5 Years of Membership
+8 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

2337 posts
  • Affiliate Level 5
  • Author Level 6
  • Collector Level 2
  • Trendsetter
+7 more
CreativeMilk
says

Use a cookie(use and not eat ;))

461 posts Don't be a HATER!
  • Weekly Top Seller
  • Elite Author
  • Author Level 8
  • Featured Author
+6 more
CodeElite
says
Use a cookie(use and not eat ;))

+1 :D

470 posts
  • Trendsetter
  • Weekly Top Seller
  • Exclusive Author
  • 5 Years of Membership
+8 more
SaurabhSharma
says
Use a cookie(use and not eat ;))

Thanks Mark. I will try with that. :)

2529 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 6
  • Blog Interview
+13 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.

470 posts
  • Trendsetter
  • Weekly Top Seller
  • Exclusive Author
  • 5 Years of Membership
+8 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