how to pass a function as part of an object in javascript without invoking the function
<p>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:</p>

<pre><code>$('#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
}
</code></pre>

<p>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: </p>

<p>success: RunAfterAjaxSubmit(param1, param2)</p>

<p>How do I change my code so it is only called after the ajax call is returned.</p>

<p>Many Thanks!</p>
