I have a form that uses jQuery to submit an ajax post and it serializes the form that is sent up. The code looks like this:
var form = $('form'); var action = form.attr('action'); var serializedForm = form.serialize(); $.post(action, serializedForm, function(data) { ... });
The problem here is that if a field has trailing white space, the serialize function will turn those spaces to plus (+) signs, when they should be stripped.
Is there a way to get the fields trimmed without doing the following:
$('#name').val( jQuery.trim( $('#name') ) );
You could try looping through the object and triming everything.