I have the following JavaScript code:

$('a.button').click(function(){
    if (condition == 'true'){
        function1(someVariable);
        function2(someOtherVariable);
    }
    else {
        doThis(someVariable);
    }
});

How can I ensure that function2 is called only after function1 has completed?

9 Answers
9

Leave a Reply

Your email address will not be published. Required fields are marked *