Well that was quick, divine intervention is not to be underrated. The javascipt "this" keep word works for what I need. So I am no longer in a fix but would still like to know how to pass extra parameters to this function
On Oct 15, 2:56 pm, Tom <[EMAIL PROTECTED]> wrote: > Hi > > I know that the success function has 2 default parameters but how do I > add a custom parameter? > > 1 - A user clicks a form (with a ID of TOM) button > 2 - The loading function gets called which just adds a class to a div > with the ID of TOM_output. > 3 - Then ajax requests comes back with success and I want to remove > the class for the target div > > How do I access the the target div from with my loaded function?? > > function button_click(myform){ > var button_output = '#' + myform.id + '_output'; > var options = { > target: button_output, > beforeSubmit: loading, > success: loaded(responseText, statusText, button_output) > }; > $(myform).ajaxForm(options); > return false; > > } > > function loading(formData, jqForm, options){ > // get form id > var form_id = jqForm[0].id; > // add loading class (starts a spinning gif) > $(form_id).addClass('spinner'); > > } > > function loaded(responseText, statusText,myform){ > // remove loading class (stops the spinning gif) > $(myform).removeClass('spinner'); > > } > > Any help most appreciated > Cheers > Tom