Revision: 33833
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 14, 2010 01:35 by virgil
Initial Code
$.fn.serializeObject = function() { //Prepping for JSON var o = {}; var a = this.serializeArray(); $.each(a, function() { if (o[this.name]) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ''); } else { o[this.name] = this.value || ''; } }); return o; };
Initial URL
http://tobiascohen.com/files/stackoverflow/jquery-form-serializeObject.html
Initial Description
usage; $.toJSON($(\'form\').serializeObject());
Initial Title
Serialize Form to JSON
Initial Tags
form, data, object, json
Initial Language
jQuery