Reputation: 57958
Right now i have a mobile page that is a search form. User searches and gets back some results. Each result is a link with further details about the result. The user clicks the details and then clicks back. This brings them back to the search page, but the previous search is no longer there.
What is the best way to redo the search (or cache results) of the search when the user goes back to the search form?
Upvotes: 4
Views: 1446
Reputation: 57309
You have few options, it all depends on do you have ajax turned on/off. In case your ajax is turned on it can be done like this:
I. Use this sintax for the div container holding the form page:
<div class="page" data-role="page" data-dom-cache="true">
Because of data-dom-cache="true" jQM will not remove that page from DOM and all your form data will be remembered.
II. Instead of classic form submit submit your data with $.ajax, and them manually changePage. This will work only if pages are not rendered with server side code.
III. Before form submit store all your form data in some javascript object and load it again on form page pagebeforeshow event.
IV. In case ajax is turned off and you are using phonegap as a app wrapper, store your form data in a local SQL light database.
Upvotes: 4
Reputation: 1516
Check out this sample to search using search input:
jQuery Mobile Example - Paged Search Results
Upvotes: 1