Passing data between pages with jQuery Mobile?

前端 未结 2 1689
粉色の甜心
粉色の甜心 2020-12-03 00:06

So I\'ve just started learning jQuery Mobile, and I\'ve learned how it loads all links via ajax without actually loading the next page. Several of my pages use forms and GET

2条回答
  •  隐瞒了意图╮
    2020-12-03 00:48

    Commonly, there 2 method for transfer parameter between jQuery Mobile page.

    1. Modify Ajax address at first page, and parse the ajax to get parameter in next page.
    2. Using HTML5 sessionStorage, a kind of WebStorage, to transfer parameter.

    This is the method use ajax address to transfer parameter. How to pass and get Parameters between two Pages in Jquery Mobile?


    Using sessionStorage/localStorage to transfer parameter, you can add this code at first page,

    
        Before go to next page, parameter id is storaged into sessionStorage.
    
    

    In next page, you can use this method to take parameter content,

    $('#page_Parameter1').live('pageshow', function(event, ui) {
        alert('Parameter ID: ' + sessionStorage.ParameterID);
    });
    

提交回复
热议问题