Passing Javascript values from page to page

Discussion in 'Web Design and Development' started by Dunmail, Dec 22, 2011.

  1. Dunmail macrumors regular

    Joined:
    Mar 27, 2009
    Location:
    Skipton, UK
    #1
    I've two pages: one is a list of items (between 50 & 100 items) each of which contains a link to page two. The ID of the item is passed via a cookie to Page two which expands on the information about that item.

    All data is held in Javascript arrays - this is due to historical reasons and the fact that I keep putting off the work to get it in to a proper database.

    The pages were originally written when I had a simple web hosting account with my ISP that didn't allow for much server side solutions. However I've been on a PHP based system for a couple of years and this has made things a lot easier.

    Without going the full get everything in to a set of MySQL tables and creating the relations between them, etc., etc., what mechanisms would you suggest to avoid the use of the cookie and to allow the Javascript on page two to get at the index passed over?

    Note that I've come up with a way but I'm not sure if it's optimal or even the best but I'll keep it to myself so as not to prejudice any response.
     
  2. Laird Knox macrumors 68000

    Joined:
    Jun 18, 2010
  3. crapthings macrumors newbie

    Joined:
    Mar 17, 2010
    Location:
    Harbin
    #3
    load a jquery

    and use $.ajax post,

    and $(selector).each get your data then post to other page.
     
  4. Dunmail thread starter macrumors regular

    Joined:
    Mar 27, 2009
    Location:
    Skipton, UK
    #4
    That's the easy part! Now the JavaScript on page 2 needs access to the item variable.
     

Share This Page