views:

126

answers:

1

Hi.

I have a script. In it is code.

I have a page. In it is some stuff from db. There is an edit button. When pressed, a div pops up and is populated with form fields via ajaxrequest -ing an external php file. the form has a name, and that name is nameEdit. On that form is a button that calls a js function--i.e. submit. in this js function is this:

function testAdd(func,cid,itemid){

 var nameFormData = $('nameEdit').serialize;
 var options = {
  method:'post',
  postBody:nameFormData,
  onCreate: function() {alert('created request'+nameFormData)},
  onSuccess: function(transport){var container_div = $('completeDiv$i');container_div.update('<b>HOKAY!</b>');},
  onComplete: function(transport){var container_div = $('updatingDiv$i');Effect.toggle('transDiv$i','appear', { delay: 1.0 });container_div.update('');},
  onFailure: function(){alert('Something went wrong...')}
 };

  new Ajax.Request('/clients/'+func+'/'+cid+'/'+itemid,options);

};

if i put a regular 'hai guise' alert in onCreate, it alerts as it should. Butt, if I add the function that is supposed to contain the serialized data, it returns this:

function () {
return __method.apply(null, [this].concat($A(arguments)));

}

also cakes: if instead of $('editName').serialize;, I have $('clientNameFirst').value;(one of the input id's inside the editName form), it will return the relevant value. Halp?

Thx.

+2  A: 
var nameFormData = $('nameEdit').serialize();

You must add the parenthesis to execute the function, or you'll get the function itself.

Fabien Ménager
Yeah, I knew that. I just wanted to see if this place works.;)Thanks!
stormdrain