Skip to content

Instantly share code, notes, and snippets.

@cafedomingo
Created August 23, 2010 08:49

Revisions

  1. cafedomingo renamed this gist Oct 15, 2010. 1 changed file with 0 additions and 0 deletions.
  2. cafedomingo renamed this gist Oct 15, 2010. 1 changed file with 0 additions and 0 deletions.
  3. cafedomingo renamed this gist Oct 15, 2010. 1 changed file with 0 additions and 0 deletions.
  4. cafedomingo created this gist Aug 23, 2010.
    13 changes: 13 additions & 0 deletions serializeToQueryString.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    serializeToQueryString(obj, props)
    {
    var params = [];
    for(prop in obj)
    {
    if(obj.hasOwnProperty(prop)
    && (!(props instanceOf Array) || props.indexOf(prop) >= 0)
    {
    params.push(prop + "=" encodeURIComponent(obj[prop]));
    }
    }
    return "?" + params.join("&");
    }