Created
August 28, 2013 18:22
-
-
Save JumboLove/6369445 to your computer and use it in GitHub Desktop.
Append param 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
| // 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