[jQuery] Help serializing form to array
Hi. What is the voodoo to build an array for a JSON submit from a
bunch of form fields?
Okay, I'm building the form dynamically from the fields in a mysql DB,
with input/@id set to the field name.
The following naive approach doesn't work, but will give you an idea
of how I'm grabbing what I want to do. It definitely doesn't like the
$.merge( parms, {this.id : this.value }) The error is "missing : after
property id"...
$("form#additem").submit(function(){
var parms = { cmd:"ADD" };
$("form#additem//input[@type=text]").each(function(){
parms = $.merge( parms, {this.id : this.value } );
});
$.getJSON("thiscode.php",parms,function(data){});
return false;
});
So, basically I am fishing for the best way to build or add to an
array from an arbitrary form and send into getJSON.
Thanks,
bill