jQuery Mobile: how to open url hash with parameter?

こ雲淡風輕ζ 提交于 2019-12-25 05:57:09

问题


I'm using jQuery Mobile 1.2.0

It's impossible to open hash with parameter.
Works - http://jquerymobile.com/demos/1.2.0/docs/pages/multipage-template.html#two
Doesn't work http://jquerymobile.com/demos/1.2.0/docs/pages/multipage-template.html#two?id=33


回答1:


It's not supported officialy, but there are workarounds. In the docs you can read more abot this (search for passing parameters under known limitations).

Quoting:

jQuery Mobile does not support query parameter passing to internal/embedded pages but there are two plugins that you can add to your project to support this feature. There is a lightweight page params plugin and a more fully featured jQuery Mobile router plugin for use with backbone.js or spine.js. A newer plugin called routerlite keeps it simple with just four methods: routeinit, routechange, pageinit and pagechange.




回答2:


If you want to do this to be able to pass variables around in a jquery mobile project, you can also use global variables in javascript or use localstorage / cookies.



来源:https://stackoverflow.com/questions/14849401/jquery-mobile-how-to-open-url-hash-with-parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!