How do I assign a function to a global variable?
<p>I'm trying to pass the name of a javascript function to a global variable. I have a generic "CallMyWebService" function built around $.ajax(). The function's url, verb, contenttype, etc. are set based on the value of global variables. Immediately before the service function is called, the globals are set and after the globals reset to nothing. </p>

<p>My generic "CallMyWebService" function is here:</p>

<pre><code>function CallMyWebService() { 

    $.ajax(
        {
        url         : varUrl,
        type        : varHttpVerb,
        cache       : varCacheBool,
        data        : varData, 
        contentType : varContentType,
        processdata : varProcessData, 
        dataType    : varDataType, 
        async       : varAsync,
        success     : varOnSuccess,
        error       : varOnError,
        complete    : varOnComplete
        }
    )

}
</code></pre>

<p>The problem I'm having is passing the function names to <code>varOnSuccess</code>, <code>varOnError</code>, and <code>varOnComplete</code>. If I have a function named <code>SuccessCallback()</code> and I want the the <code>result</code> of the service call passed to <code>SuccessCallback()</code>, how do I assign it to the <code>varOnSuccess</code> global variable? The variable assignment will take place in another function called <code>SetupServiceCall()</code>. In other words, in the <code>SetupServiceCall()</code> function how should <code>varOnSuccess =</code> be completed?</p>
