Skip to content

Instantly share code, notes, and snippets.

@drainpip
Created September 26, 2017 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drainpip/272e0dcd8e2648dc17d475c2ed11f382 to your computer and use it in GitHub Desktop.
Save drainpip/272e0dcd8e2648dc17d475c2ed11f382 to your computer and use it in GitHub Desktop.
JS get query string as object
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];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment