code: function (params, noEncode) {
        if(this.isObject(params)){
  
          var paramsStr = [];
  
          for (var key in params) {
            if (params.hasOwnProperty(key) && params[key] !== undefined) {
              var value = this.isObject(params[key])? this.buildParams(params[key], true) : params[key];
              paramsStr.push((noEncode? key : encodeURIComponent(key)) +
                '=' + (noEncode? this.escapeSpecials(value) : encodeURIComponent(value)));
            }
          }
  
          // Build string from the array.
          return paramsStr.join('&');
  
        } else {
          return params;
        }
      }
docs: Build URL query string params out of a javascript object. Encode key and value components as they are appended to query string.