Created
August 8, 2018 03:48
-
-
Save framingeinstein/66814d3d63af85e3d3cdc664e827102d 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 parseQuery(href){ | |
var qo = {}; | |
var parts = href.split('?'); | |
var query = []; | |
if(parts.length > 1){ | |
query = parts[1].split('&'); | |
} | |
if(query.length > 0){ | |
if(query[0] == ""){ | |
query.shift(); | |
} | |
for(var i = 0; i < query.length; i++){ | |
var kv = query[i].split('=') | |
qo[kv[0]] = ''; | |
if(kv.length > 1){ | |
qo[kv[0]] = kv[1]; | |
} | |
} | |
} | |
return qo; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment