1212

test when

by QMaster

HTML

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
  <div id="fire" style="background-color: blue;">Hey</div>
</body>
</html>

JavaScript

var d1 = $.Deferred();
var d2 = $.Deferred();
 
$.when( d1, d2 ).done(function ( v1, v2 ) {
    console.log( v1 ); // "Fish"
    console.log( v2 ); // "Pizza"
});
 
d1.resolve( "Fish" );
//d2.resolve( "Pizza" );

$("#fire").on('click','', function(){
  d2.resolve( "Pizza" );  
});