I’ve built a number of apps through Phonegap and I recently came up against the problem of how to pass variables between pages. There seem to be a couple of ways to do this but the simplest and most obvious way it to use local storage. Once you have the data you want to pass to the next page it’s just a case of saving it local storage. For me, this was once a tap event had taken place e.g.
$('#myPage a').live('tap', function() {
// Save variable to local storage
var userName = $('input').val();
localStorage.setItem("Name", userName);
>});
Then it’s just case of retrieving it on the next page.
var userName = localStorage.getItem('userName');
Any there you have it. A simple and effective way of passing data between pages in jQuery Mobile.