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

4

1 回答 1

2

您没有将回调传递给.then,而只是 console.logging "Then!" 立即地。

你想要的是:

.then( function(){
    console.log( "Then!" );
});
于 2013-10-15T20:41:10.347 回答