Javascript Closure calling a Call back function?
<p>So I have tons of function that are very similar to each other. IE time to refactor via closures but I ran into a problem.</p>

<p>My functions skeleton code is something like this (i have tons of this in my javascript):</p>

<pre><code>function getBlahOutputInThisID(param1, ...., paramN, functionName) {
    var jasonArray = {
        param1: param1,
        param2: param2,
        ...
    }
    jQuery.ajax({
        type: 'POST',
        url: '/blahController/ajax_functionName/',
        data: jasonArray,
        success: function(data) {
          //Some REALLY custom function stuff
        }
    });
}
</code></pre>

<p>So since I have tons of these:</p>

<p>I was wondering if I can do a closure</p>

<pre><code>function closure(paramArray, customFUNCTION) {
    return function() {
        //getBlahOutputInThisID code (the skeleton code, look above)
    }
}
</code></pre>

<p>and have it call the callback function, customFunction in the closure (the <code>jQuery.ajax({</code> part), ie:</p>

<pre><code> success: function(data) {
          customFunction()
        }
</code></pre>

<p>Or is this a very noob/bad way to refactor codes? </p>

<p>Edit: Thank you for your time and effort.</p>
