Sourabh Dhiman

Sourabh Dhiman

  • 1.7k
  • 171
  • 5.2k

sequential using jquery ?

Oct 10 2019 6:43 AM
  1. var d1 = $.Deferred();  
  2. var d2 = $.Deferred();  
  3.    
  4. $.when( d1, d2 ).done(function ( v1, v2 ) {  
  5.     console.log( v1 ); // "Fish"  
  6.     console.log( v2 ); // "Pizza"  
  7. });  
  8.    
  9. d1.resolve( "Fish" );  
  10. d2.resolve( "Pizza" );  
Please check this code . Its run.
  1. var d1 = $.Deferred();  
  2. var d2 = $.Deferred();  
  3.    
  4. $.when( d1, d2 ).done(function ( v1, v2 ) {  
  5.    
  6.     console.log( v2 ); // "Pizza"  
  7.  console.log( v1 ); // "Fish"   
  8. });  
  9.    
  10. d1.resolve( "Fish" );  
  11. d2.resolve( "Pizza" );  
I will change console.log(v1); My output pizaa , fish
But i want to output same , for eg -fish and pizaa . How it's possible. Please solve this

Answers (2)