Skip to content

Instantly share code, notes, and snippets.

@aGiftKit
Last active August 29, 2015 14:01
Show Gist options
  • Save aGiftKit/0d628321cf2b50da4cc9 to your computer and use it in GitHub Desktop.
Save aGiftKit/0d628321cf2b50da4cc9 to your computer and use it in GitHub Desktop.
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