jQuery Mobile and “query parameters” for hashbang navigation

后端 未结 3 1686
太阳男子
太阳男子 2021-02-20 03:13

I am using jQuery Mobile and have few pages in one HTML page. When opening these pages, I\'d like to pass parameters for them, so that their parameters are persistent in URL.

3条回答
  •  春和景丽
    2021-02-20 03:35

    Yes, you can have links like the one you showed:

     Click here 
    

    Then, on before show you can read this params with this code:

    var params = QueryStringToHash(location.hash.substr(1));
    //Now you can use params.x, params.y, etc
    

    The definition of the QueryStringToHash (got from here) is the following:

    var QueryStringToHash = function QueryStringToHash  (query) {
      var query_string = {};
      var vars = query.split("&");
      for (var i=0;i

    Hope this helps. Cheers

提交回复
热议问题