Skip to content

Instantly share code, notes, and snippets.

@oomlaut
Created July 23, 2011 15:14
Show Gist options
  • Save oomlaut/1101534 to your computer and use it in GitHub Desktop.
Save oomlaut/1101534 to your computer and use it in GitHub Desktop.
Parse the querystring with jQuery, returning an object containing index/value pairs
jQuery.extend({
parseQuerystring: function(){
var nvpair = {};
var qs = window.location.search.replace('?', '');
var pairs = qs.split('&');
$.each(pairs, function(i, v){
var pair = v.split('=');
nvpair[pair[0]] = pair[1];
});
return nvpair;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment