jQuery , bind a callback to any function
<p>I would like to be able to bind a callback function to a previously defined function
and being able to use two variables defined in the scope of that function.</p>

<p>It should look like this: </p>

<pre><code>function mainFunction(){
  var localForMain;
}

 $(document).ready(function(){

     // bind a call back method to the 'mainFunction'
     $(mainFunction).bindCallback(function(){

        // ...use the localForMain variable HERE;

     });


 });
</code></pre>

<p>Is it possible to achieve something like this?</p>
