Run function after another one completes

http://stackoverflow.com/questions/25144161/run-function-after-another-one-completes

HTML

<button>click</button>

CSS

button {
    width: 100px;
    -webkit-transition: all 1s;
}
.transition {
    width: 150px
}

JavaScript

$(function() {

$.when( functionOne() ).done(function( x ) {
  functionTwo()
});


    var functionOne = function() {
 
  var r = $.Deferred();
 
  // Do your whiz bang jQuery stuff here
 setTimeout(function(){console.log('Function One')},3000);
  
 
  return r;
 
};
 
var functionTwo = function() {
 
  // Do your whiz bang jQuery stuff here
  console.log('Function Two');
 
};
 
// Now call the functions one after the other using the done method
//functionOne().done( functionTwo() );
  
});