Created
July 23, 2011 15:14
-
-
Save oomlaut/1101534 to your computer and use it in GitHub Desktop.
Parse the querystring with jQuery, returning an object containing index/value pairs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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