-2

I have index page with navigation menu like this

man
  caps
  shirt
  jeans

woman
  caps
  shirt
  jeans

Now what have i done so far that by clicking each link say jeans from man the text is sent via jquery ajax to php at server, it retrieves all man jeans images and send it back to the index page, empty the main-content area and display it there

Now what happens that when i reload the page all vanishes displaying the home /index page

I have saw cookies but cant set it for the links any code will be very helpfull that how to set cookies for maintaining that bunch of images in the div and then when user clicks another link say women caps that div is filled with caps images with cookies set to that images.

Another thing in my mind is to make a page say products.html when the user clicks the link this page is loaded in the same browser window with similar header, footer and navigation menu but an empty main content area and when landing on this page the main-content is filled with that clicked link images so if the reload is clicked it will remain on the same page to get rid of the cookies dragon but cant do code for my second idea

regards sajid

sajid
  • 247
  • 7
  • 15

2 Answers2

1

When they click on "Jeans" (say) you could set the page to be www.mysite.com/#jeans. When the page is refreshed, pick up the #jeans using Javascript and load the appropriate images.

Although I'm not sure why you can't just use cookies (although I must confess that my eyes were getting tired by that point).

Grim...
  • 16,518
  • 7
  • 45
  • 61
1
 <a href="#graphicsDesign">Graphics</a>
 if(window.location.hash === "graphicsDesign" ||
    window.location.hash === "somethingElse") {
    loadContent(window.location.hash);
 }

Reference Working with single page websites and maintaining state using a URL hash and jQuery

Community
  • 1
  • 1
The Alpha
  • 143,660
  • 29
  • 287
  • 307