Skip to content

Instantly share code, notes, and snippets.

@ithinkihaveacat
Created April 22, 2009 10:45
Show Gist options
  • Save ithinkihaveacat/99712 to your computer and use it in GitHub Desktop.
Save ithinkihaveacat/99712 to your computer and use it in GitHub Desktop.
// If you already have a Prototype dependency, see
//
// http://www.prototypejs.org/api/hash/toQueryString
var toQueryString = function(hash) {
var s = "";
for (var k in hash) if (hash.hasOwnProperty(k)) {
if (s !== "") { s += "&"; }
s += encodeURIComponent(k) + "=" + encodeURIComponent(hash[k]);
}
return s;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment