jQuery - Serialize
Updated at 2013-05-05 07:58
This note contains snippets about jQuery serialization.
var $form = $('#register-form');
// Turn all form fields into a URL friendly key/value string.
// This can be passed as argument of AJAX requests, or URLs.
console.log($form.serialize());
// You can also encode custom objects with the $.param method.
console.log($.param({'pet':'cat', 'name':'snowbell'}));
// With $.serializeArray() you can encode the form to an object.
console.log($form.serializeArray());