executar a função depois que outros terminam JS
$.when(function1()).then(function2());
Jittery Jay
$.when(function1()).then(function2());
function1(someVariable, function() {
function2(someOtherVariable);
});
}
function function1(param, callback) {
...do stuff
callback();
}