Bug Tracker

Opened 10 years ago

Last modified 10 years ago

#11002 closed feature

Add serializeObject method to core — at Initial Version

Reported by: ajpiano Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: 1.8-discuss Cc:
Blocked by: Blocking:

Description

It's probably more useful into have a method in core for serializing a form directly to an object, instead of an array of objects with name and value keys. Luckily, Ben Alman has a very small implementation that leverages the existence of serializeArray to give us just such a method.

My experience tells me this is a relatively common use-case: I've used it on a number of projects, and I've directed numerous people toward it as well in the last year or two. Not only is it beneficial when developing single-page apps with Backbone or the like, it's considerably simpler than existing options (in core) for users who need to submit a form via ajax, but also want to augment the data with some properties beforehand.

https://raw.github.com/cowboy/jquery-misc/master/jquery.ba-serializeobject.js

While most plugins should stay just that - plugins - I think that this feature is common enough, lean enough, and low-level enough for us to be able to offer it in core.

Change History (0)

Note: See TracTickets for help on using tickets.