Tutorial Get Query Params as Object
Nicholas Ortenzio wrote this little plugin: jQuery.extend({ getQueryParameters : function(str) { return (str || document.location.searc...
https://iskablogs.blogspot.com/2014/03/tutorial-get-query-params-as-object.html
Nicholas Ortenzio wrote this little plugin:
jQuery.extend({
getQueryParameters : function(str) {
return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
}
});
So if the URL is:
http://codepen.io/chriscoyier/pen/uszCr?lunch=sandwich&dinner=stirfry
You can do:
var queryParams = $.
jQuery.extend({
getQueryParameters : function(str) {
return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
}
});
So if the URL is:
http://codepen.io/chriscoyier/pen/uszCr?lunch=sandwich&dinner=stirfry
You can do:
var queryParams = $.