Created
August 7, 2011 17:54
-
-
Save benbahrenburg/1130590 to your computer and use it in GitHub Desktop.
Query Stringify example based on the YUI plugin
This file contains 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
//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