This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
simple-disco-store/jquery.qs.js

20 lines
558 B
JavaScript

/* Copied from http://paulgueller.com/2011/04/26/parse-the-querystring-with-jquery/
* Modification: added decoding of parameters value using unescape()
* Usage:
* var qs = jQuery.parseQuerystring();
* //qs['foo'] == "bar"
* //qs.somevalue == "myvalue"
*/
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]] = unescape(pair[1]);
});
return nvpair;
}
});