Currently I use page numbers in hashes with Ben's Alman jquery-hashchange plugin:
$(document).ready(function(){
$(window).hashchange( function(){
var hash = (location.hash) ? location.hash.slice(1) : 'page1';
$.ajax({
url: '/list/' + hash, // result url like page1, page2 etc.
Now I need to add there one more value - filter
.
I think result hash URL can look like
#page1&filter=1-1-0
#filter=1-1-0 (if page number is omitted)
#page1 (if filter is not defined)
How to parse that? I.e. how to understand if page
is defined, if filter
is defined (and what are the values - 1
, 1
and 0
- I need them separately)?
I was thinking about Ben's Alman BBQ plugin, but (1) it looks too complicated for such simple task, (2) not sure how to use parameters (page1, page2 etc.) without values.