Here's another example:
$.when( $.ajax("foo.php") ).done(function() {
// arguments[0] is the responseText
// arguments[1] is the status text
// arguments[2] is the jqXHR object
});
$.when( $.ajax("foo.php"), $.ajax("bar.php") ).done(function() {
// arguments[0] is an array of arguments from the first ajax request
// arguments[0][0] is the response text from the first ajax request
// arguments[0][1] is the status text from first ajax request
// arguments[0][2] is the jqXHR object from the first ajax request
// arguments[1] is an array of arguments from the second ajax request
// arguments[1][0] is the response text from the second ajax request
// arguments[1][1] is the status text from
second ajax request
// arguments[1][2] is the jqXHR object from the second ajax request
});
It works this way because $.when simply returns the passed in deferred object if only one deferred object is passed to it.
-- Kevin