问题
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