Skip to content

Instantly share code, notes, and snippets.

@aGiftKit
Last active Aug 29, 2015
Embed
What would you like to do?
We use this function to encode the data that we are preparing to send in an Ajax call.
// return object as URL encoded string
// I did not write this code, it was pasted from somewhere.
UrlEncodeObj = function (o) {
var sdata = '';
for (var k in o) {
if (sdata) {
sdata += '&';
}
sdata += k + '=' + escape(o[k]);
}
return sdata;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment