Persisting data between jQuery Mobile pages
In this recipe, we will build upon the podcast application built in the previous recipe, extending the functionality and features available for the user.
So far, our podcast application consists of a few simple pages that are independent of each other; that is, any content consumed by a page is used by that page only.
How to do it...
We will use the localStorage
capabilities to save and retrieve information, causing it to persist across pages:
With the list now populated, we need to revise the home method to include a function to capture the tap events on each list item. This will obtain the
title
,enclosure
, anddescription
attribute values from the selected item and set them in thelocalStorage
on the device so that we can cause them to persist on the next screen. Then we'll force a page change to a new page calleditemdetail
:$("#home").bind("pagecreate", function(e) { getRemoteFeed(); $('#showList').on('click', 'li', function() { ...