/jquery.serialize_form

Primary LanguageCoffeeScriptMIT LicenseMIT

$.serialize_form

After being fed up with how the default jQuery serialization worked, I wrote this little (257 bytes minified) plugin to get jQuery working in the format that I want. The largest feature is that it preserves correct formatting of items[] recurring form elements, and returns an object instead of an array.

Usage

HTML

<form id="my_form">
    <input name="category_name" value="My Category">
    <input name="post[]" value="1">
    <input name="post[]" value="2">
    <input name="post[]" value="3">
</form>

Coffee

console.log ($ '#my_form').serialize_form()

Result

The jsFiddle of this example can be seen here

License

This is released under the MIT License, which is in the LICENSE file.