Skip to content

Instantly share code, notes, and snippets.

@JumboLove
Created August 28, 2013 18:22
Show Gist options
  • Select an option

  • Save JumboLove/6369445 to your computer and use it in GitHub Desktop.

Select an option

Save JumboLove/6369445 to your computer and use it in GitHub Desktop.
Append param to URL
// appends the parameter with the given name and
// value to the given url and returns the changed url
appendParamToURL: function(url, name, value) {
var c = "?";
if (url.indexOf(c) != -1) {
c = "&";
}
return url + c + name + "=" + encodeURIComponent(value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment