Skip to content

Instantly share code, notes, and snippets.

@sh1mmer
Created April 3, 2010 23:28
Show Gist options
  • Save sh1mmer/354941 to your computer and use it in GitHub Desktop.
Save sh1mmer/354941 to your computer and use it in GitHub Desktop.
var data = "";
for (p in parameterMap) {
data += p + "=" + encodeURIComponent(parameterMap[p]) + "&";
}
//kill the trailing &
data = data.slice(0,-1);
@ktiedt
Copy link

ktiedt commented Apr 4, 2010

since you are already looping over the object...

var data = [];
for (p in parameterMap) {
data.push(p + '=' + encodeURIComponent(parameterMap[p]));
}
//kill the trailing &
data = data.join('&');

@sh1mmer
Copy link
Author

sh1mmer commented Apr 4, 2010

Whoops. Already revved it over here: https://gist.github.com/354949/76df91273a5be7370f0df004f934dad95a6d3e23

Thanks for the suggestions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment