Created
March 14, 2016 02:26
-
-
Save gonejack/758627e13932855e8d92 to your computer and use it in GitHub Desktop.
append query parameters to 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
function (url, name, value) { | |
if (url) { | |
var parser = document.createElement('a'); | |
parser.url = url; | |
return url + [(parser.search ? '&' : '?'), name, '=', value].join(''); | |
} | |
else { | |
return ''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment