Skip to content

Instantly share code, notes, and snippets.

@gonejack
Created March 14, 2016 02:26
Show Gist options
  • Save gonejack/758627e13932855e8d92 to your computer and use it in GitHub Desktop.
Save gonejack/758627e13932855e8d92 to your computer and use it in GitHub Desktop.
append query parameters to URL
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