www.webdeveloper.com
Results 1 to 3 of 3

Thread: Saving data when navigating to another page

  1. #1
    Join Date
    Apr 2013
    Posts
    2

    Question Saving data when navigating to another page

    Hello guys,
    I will make a quick description of the problem:
    So, i created 2 pages that are linked and on each page there is a 'click here to add 1' button that wouldincrement a variable by 1 (i did this just to get an easier understanding of how to save data when you navigate to another page). When you click that button it alerts the value you currently are at. If i click iton the same page everything works just fine, but when i click the link to the second page and click the button again the counting starts again from 1, but i would like it to continue from the last value that was on the page before.
    this is the code:
    Code:
    $(document).ready(function(){
    var $c = 0;
    $('.add').click(function(){
    	$c++;
    	alert($c);
    	});
    });

  2. #2
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,266
    Two solutions before the data base :
    1. datas in URL (with a ?count=13 at the end of the address (for few datas),
    2. cookies, see for example PPK functions

  3. #3
    Join Date
    Apr 2013
    Posts
    2
    I'll give it a shot, thank a lot.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles