I am trying to use .ajaxSubmit(). I want to pass it the options object. I want to create this options object based on the user's behavior. So this is how I am doing it:
$('#my-form').ajaxSubmit(GetSearchAjaxFormOptions(param1, param2));
function GetSearchAjaxFormOptions(param1, param2) {
return { target: '#results',
data: GetData(),
success: RunAfterAjaxSubmit(param1, param2)
};
}
function RunAfterAjaxSubmit(param1, param2) {
// do stuff
}
Everything works fine except that RunAfterAjaxSubmit is called not only after the ajax call returns, but also before the ajax call is made at the following line:
success: RunAfterAjaxSubmit(param1, param2)
How do I change my code so it is only called after the ajax call is returned.
Many Thanks!