Last active
May 25, 2021 02:19
-
-
Save ruan4261/7fff1cfd0b9ab7579caf04aaae33b541 to your computer and use it in GitHub Desktop.
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 getUrlParams() { | |
var query = location.search// from ? to # | |
var params = {} | |
if (query.length > 1) { | |
var queryStr = query.substr(1) | |
var entry = queryStr.split('&') | |
for (var i = 0; i < entry.length; i++) { | |
var kv = entry[i].split('=') | |
var key = kv[0] | |
var value = kv[1]// maybe undefined | |
params[kv] = value | |
} | |
} | |
return params | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment