Skip to content

Instantly share code, notes, and snippets.

@adw0rd
Created May 7, 2013 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adw0rd/5533962 to your computer and use it in GitHub Desktop.
Save adw0rd/5533962 to your computer and use it in GitHub Desktop.
function(url, params) {
var parser = document.createElement('a');
parser.href = url;
var chunks = [];
for(var param in params) {
chunks.push(encodeURIComponent(param) + "=" + encodeURIComponent(params[param]));
}
parser.search = (parser.search ? parser.search + '&' : '?') + chunks.join("&");
return parser.href;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment