1

I have a webpage on which contents are also added dynamically using ajax. For example adding images though image and add draggable to it using jquery so they can be dragged.

Now , i want to save the state of webpage after images are added and are made draggable, so if user navigates away from page and again come back to same page using a link, he is able to see his added images and can also drag it.

How this can be achieved using jquery or anything. I dont have a clue about how we can do this. Any pointers to this will be of great help.

I am using php and jquery.

kailash19
  • 1,771
  • 3
  • 22
  • 39

2 Answers2

3

You can use html5 web storage concepts for saving state of your page. sessionStorage would be easiest to implement. You can find code samples of sessionStorage and other storage types here.

If html5 is not an option then you can use cookies to store the state of page. You can access cookies via Javascript. You can also use jquery plugin jquery-cookie for easy implementation.

You can also find more discussion on How do I set/unset cookie with jQuery?

Community
  • 1
  • 1
Naveed
  • 1,191
  • 10
  • 22
1

You can save the state in some hidden field with javascript and access that hidden field through ajax call or post back with server side code (php). Extract the state of page interpret it and save in some persistent medium like database.

Adil
  • 146,340
  • 25
  • 209
  • 204