Get the queryString module from: https://github.com/sindresorhus/query-string
Forked from sindresorhus/query-string-example.js
Last active
August 29, 2015 14:17
-
-
Save Rhincodon/9db51d724461f06b57ab to your computer and use it in GitHub Desktop.
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 the queryString module from: | |
// https://github.com/sindresorhus/query-string | |
console.log(location.href); | |
// http://sindresorhus.com/?foo=bar | |
console.log(location.search); | |
// ?foo=bar | |
var parsed = queryString.parse(location.search); | |
console.log(parsed); | |
// {foo: 'bar'} | |
parsed.foo = 'unicorn'; | |
parsed.ilike = 'pizza'; | |
location.search = queryString.stringify(parsed); | |
console.log(location.search); | |
// ?foo=unicorn&ilike=pizza |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment