Created
November 28, 2016 23:25
-
-
Save noahduncan/ed0b2d29bded55d1464f0521ad3e1b4b to your computer and use it in GitHub Desktop.
Get Query Params
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
function getQueryParams(qs) { | |
qs = qs.split('+').join(' '); | |
var params = {}; | |
var tokens; | |
var re = /[?&]?([^=]+)=([^&]*)/g; | |
while (tokens = re.exec(qs)) { | |
params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); | |
} | |
return params; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment