I'm using the jQuery plugin located at the following URL. http://www.malsup.com/jquery/form/#code-samples
The problem I'm having is with a submit button. I want to have the submit button disabled during the ajax call, and enabled once the call is finished. I want to use the options beforeSubmit and success to call these functions, however, I'm not sure exactly how this works. I want to call say toggleSubmit and pass through a value of true or false (depending on what callback option it's on). So for example, options would look like this. var options = { target: '#results', beforeSubmit: toggleSubmit(true), success: toggleSubmit(false) }; This doesn't work though because it's actually executing the two functions when the variable options is defined. So essentially I'm forced to create two functions that do not take any arguments. (i.e. enableSubmit(), disableSubmit()). Is there any way around this? Thanks in advance.