javascript serialize object for post code example
Example: send serialized form data jquery
var paramObj = {};
$.each($('#myForm').serializeArray(), function(_, kv) {
if (paramObj.hasOwnProperty(kv.name)) {
paramObj[kv.name] = $.makeArray(paramObj[kv.name]);
paramObj[kv.name].push(kv.value);
}
else {
paramObj[kv.name] = kv.value;
}
});