What may work out better is to use a Promise A+ spec library like bluebird in place of jQuery's lacking implementation. The reason for this is you can use a method like Promise.join that will allow you to assign multiple promises that need to be resolved before the handler is executed. The promise results will be arguments to the function so the code could look like this:
The code at activeb_master.coffeeL#26 doesn't assign the session variable to a scope that is accessible to code running at activeb_master.coffeeL#28
What may work out better is to use a Promise A+ spec library like bluebird in place of jQuery's lacking implementation. The reason for this is you can use a method like Promise.join that will allow you to assign multiple promises that need to be resolved before the handler is executed. The promise results will be arguments to the function so the code could look like this:
Sorry I am not too familiar with coffee script hence why my examples are in plain JS.