title: JavaScript Array to URLencoded - wthis array in obj
body: <p>I have array like this</p>
  
  <pre><code>{
  search: "job", 
  keywords: "", 
  cat: [12,28,38]
  }
  </code></pre>
  
  <p>and I need url string like this </p>
  
  <pre><code>?search=job&amp;keywords=&amp;cat%5B%5D=12&amp;cat%5B%5D=28&amp;cat%5B%5D=38
  </code></pre>
  
  <p>for my query in worpdress</p>
  
  <p>please, help </p>
  
  <p>This code</p>
  
  <pre><code>var serialize = function(obj, prefix) {
      var str = [],
          p;
      for (p in obj) {
          if (obj.hasOwnProperty(p)) {
              var k = prefix ? prefix + "[" + p + "]" : p,
                  v = obj[p];
              str.push((v !== null &amp;&amp; typeof v === "object") ?
                  serialize(v, k) :
                  encodeURIComponent(k) + "=" + encodeURIComponent(v));
          }
      }
      return str.join("&amp;");
  };
  </code></pre>
  
  <p>and I have this </p>
  
  <pre><code>search=job&amp;keywords=&amp;cat%5B0%5D=12&amp;cat%5B1%5D=28&amp;cat%5B2%5D=38 
  </code></pre>
  
  <p>but I do not need an index whith "cat"</p>