That worked, thanks! I'll check out the form plugin... just wanted to figure out what I was doing wrong first. :-)
On Aug 28, 3:36 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote: > I think you could replace the parms = ... line with: > > parms[this.id] = this.value; > > But I suggest you check out the awesome form plugin: > > http://www.malsup.com/jquery/form/ > > --Erik > > On 8/27/07, bweaverusenet <[EMAIL PROTECTED]> wrote: > > > > > 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//[EMAIL PROTECTED]").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