0

I followed this link:

Pass parameter between pages using jquery mobile

But all it is doing is

 1) pass a parameter to a new HTML page(one.html->two.html)
 2) Read what's been passed from one.html in one.html before page disappears.
 - but i want to read the data in two.html, not in one.html

Isn't it? I maybe wrong. But that's what the code seems to be doing.

in one.html, i'm passing the data to two.html like this:

$( document ).delegate("#page1", "pageinit", function() {

    $.mobile.changePage('two.html', { 
        dataUrl : "two.html?paremeter=123", 
        data : { 'paremeter' : '123' }, 
        reloadPage : true, changeHash : true
    });

});

How to I retrieve this data from two.html?

Community
  • 1
  • 1
Joon. P
  • 2,238
  • 7
  • 26
  • 53

1 Answers1

1

in two.html

$(document).on('pageshow', "#twoIndex", function (event, data) {
    var parameters = $(this).data("url").split("?")[1];;
    parameter = parameters.replace("parameter=","");  
    alert(parameter);
});

consider using localStorage and sessionStorage. for more have look at gajotres's blog post.

Arpit Vasani
  • 1,013
  • 8
  • 19