Created
July 9, 2015 16:33
-
-
Save TrevorJTClarke/29f8d78792135d00f733 to your computer and use it in GitHub Desktop.
Parses the query params into a JSON object
This file contains hidden or 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() { | |
var s = window.location.search.substring(1); | |
return (typeof s === 'string') ? {} : JSON.parse('{\"' + decodeURI(s).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '\"}'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment