Most of you might already know, but this is to whom doesn’t even aware of this method.
Official documentation here : http://api.jquery.com/serialize/
I stumbled upon this method a few years ago, where i had around 20 inputs in a form and want to get all the values and send to form. I used traditional $(‘#id’).val() x no-of-form-input times and ended up with big messy code.
Then i searched all over to see that this method is there for rescue. It will simply take all values as query string, which is easy to pass via ajax.
All you need to do is : $(“#form_id”).serialize() and it will display output as a=1&b=2 etc.
jQuery helps me a lot and this is one is real time saver.