Javascript - Control flow
===

I need a little help in best practices around "control flow" within javascript. In the below example my updateUI function is not properly working because my saveData function has not yet completed.

    function save(data){
       saveData(data);
       updateUI();
    }

For a temporary fix, I did this

    function save(data){
    if(saveData(data)){
       updateUI();
       }
    }

I feel like I should learn the "standard" way, if such one exists.