Pass parameter between pages using jquery mobile

前端 未结 2 1770
余生分开走
余生分开走 2020-11-29 09:19

What is the right way to pass parameters between pages in jquery mobile. In Q&A of jquery mobile, there is some suggestion for plugin. Is it mandatory? Please let me kno

2条回答
  •  無奈伤痛
    2020-11-29 09:44

    You can also use it with external relations in links (for me and my purpose its easier), so I wanted to share this:

    HTML:

     Structure
    

    JS:

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

    In my case, the structure='123' is created dynamically, nobody writes a fixed value '123' for dynamic purposes :-)

    Thanks for the URL-splitting of the above post (pls. favor his post), this is just an addition / further explanation.

提交回复
热议问题