Lose dynamic content after page refresh in jQuery Mobile

1.1k views Asked by At

Here is my problem: I'm developing a mobile web app with jQuery Mobile and I have to create dynamic content.

In the first page I have a listview with some <li>elements. When I click in one of these <li> I go to another page and create the content dynamically. So the content of the second page is different for every <li> of the first page.

My problem is when I refresh the second page all dynamic content disappears because it has lost the parameters. To solve this I tried to use the querystring, for example <a href="secondPage?=id=2"> but this did not work.

What I ask you is if there is another way to pass the parameters through pages with jQuery Mobile so that when I refresh the page I don't lose the content.

Thank you

2

There are 2 answers

6
bardiir On

You can use window.location.hash so save/load your data. Just save the data there in a string format on data change an on page load check if anything is there.

The data in there will be appended to your URL as a hash: example.com/url#yourdata

0
ghostCoder On

Use http://westcoastlogic.com/lawnchair/
just save the parameters u need in the local db and then get it on the second page to use.