title: jquery remove empty or white space values from url parameters
body: <p>I am using <code>form.serialize()</code> to get the list of parameters.</p>
  
  <p>If parameter is empty or its space, i want to remove it from the list.</p>
  
  <p>For example:</p>
  
  <pre><code>testAction.action?a=1&amp;b=&amp;c=3 
  </code></pre>
  
  <p>should give me </p>
  
  <pre><code>testAction.action?a=1&amp;c=3
  </code></pre>
  
  <p>First I was using regex:</p>
  
  <pre><code>params = params.replace(/[^&amp;]+=\.?(?:&amp;|$)/g, '');
  </code></pre>
  
  <p>But problem is that if my url is </p>
  
  <pre><code>testAction.action?a=1&amp;b=2&amp;c= 
  </code></pre>
  
  <p>regex will return me</p>
  
  <pre><code> testAction.action?a=1&amp;b=2&amp; (i have &amp; at the end!)
  </code></pre>
  
  <p>After that I tried jQuery solution</p>
  
  <pre><code>$('.myForm').find('input, select').not("[value='']").serialize();
  </code></pre>
  
  <p>but this is only working for empty values -> if i have space parameter in the value that will pass.</p>
  
  <p>Can you help me with some other solution?</p>
  
  <p>Thanks</p>