jquery/jquery-mobile — Issue #3198: Support for query string parameters in nested lists sub pages.
Author: mrbichel
Created: 2011-12-01 19:56:08+00:00
State: open

As also reported and discussed in [issue #10](https://github.com/azicchetti/jquerymobile-router/issues/10) on JQM router issue tracker. Andrea has proposed one solution.

Problem:
You arrive at a nested list at:

`#library?section=cooking`

You click to expand the list item French cuisine and end up at

`#library&ui-page=french-cuisine`

Everything is still going fine here, but then you reload the page or copy the link to save or send to a friend and you end up at a blank page because library does not know you are in the cooking section anymore and does not generate the correct nested list for you. Instead the hash should have changed to:

`#library&ui-page=french-cuisine?section=cooking`

The problem arises if you use a query string taken from the hash to dynamicly built a JQM nested list. This works fine at the top level url, but when you navigate to the nested part of the list JQM replaces the existing query string with `&ui-page=id`. This means that if you reload the page it does not find any data, and it means the url is not bookmarkable. We need to find a way to handle query strings and JQM sub pages like the nested lists.

This problem also arises if you use the recommended way of implementing query strings in the JQM documentation here http://jquerymobile.com/demos/1.0/docs/pages/page-dynamic.html and then choose to build a nested list.

In short jquery should preserve the current custom hash query string when navigating to a subpage.