Try the jQuery query plugin . This is pretty intuitive. You can use get and set accessors to read and modify the query string:
var cow = $.query.get('cow'); $.query.set('cow', 'goat');
You can create a new query object from an existing line:
var fromVar = $.query.load('?cow=milk') var cow = fromVar.get('cow');
You can also create an empty object:
var newQ = $.query.empty(); newQ = newQ.set('first', 'value');
Matthew flaschen
source share