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