Skip to content

Instantly share code, notes, and snippets.

@benbahrenburg
Created August 7, 2011 17:54
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 benbahrenburg/1130590 to your computer and use it in GitHub Desktop.
Save benbahrenburg/1130590 to your computer and use it in GitHub Desktop.
Query Stringify example based on the YUI plugin
//This snippet is based on the below:
//http://alloy.liferay.com/deploy/api/querystring-stringify-simple-debug.js.html
function queryStringify(obj, sep, eq) {
sep = sep || "&";
eq = eq || "=";
var qs = [], key, escape = encodeURIComponent;
for (key in obj){
if (obj.hasOwnProperty(key)) {
qs.push(escape(key) + eq + escape(String(obj[key])));
}
}
return qs.join(sep);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment