Last active
July 28, 2016 22:23
-
-
Save ryanwinchester/acf30edbd7a13d6e4d3dd42a7bee1ecd to your computer and use it in GitHub Desktop.
Get query parameter from url
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
| get_query_var(name) { | |
| var pairs = window.location.search.substring(1).split("&"); | |
| return pairs.reduce((carry, pair) => { | |
| if (pair.split("=")[0] == name) | |
| return pair.substring(pair.indexOf("=") + 1); | |
| return carry; | |
| }, {}); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment