0

The following code should be straightforward

//Generic success routine, let the developer know, store the results
function genericSuccess( _data , textStatus , jqXHR )
{
  data[this.url] = _data;
}

jQuery.when(  $.ajax({ url: metaKey, success: genericSuccess }) , 
              $.ajax({ url: docsKey, success: genericSuccess }) ).then( console.log( "Then!" ) );

But console.log('Then') keeps triggering first. Why ? This does not work with 1.7.2 and 1.8.3

Charles
  • 50,943
  • 13
  • 104
  • 142
tomdemuyt
  • 4,572
  • 2
  • 31
  • 60

1 Answers1

2

You aren't passing a callback to .then, instead you're just console.logging "Then!" immediately.

What you want is:

.then( function(){
    console.log( "Then!" );
});
Kevin B
  • 94,570
  • 16
  • 163
  • 180