Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12402 closed feature (invalid)

Ability to do $.when(<ajax request 1>).when(<ajax request 2>).then(<ajax callback>);

Reported by: serovovo@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:

Description

Ability to do $.when(<ajax request 1>).when(<ajax request 2>).then(<ajax callback>);

It will be nice!

Change History (5)

comment:1 Changed 7 years ago by serovov@…

Just posting this comment to trak this issue.

comment:2 Changed 7 years ago by dmethvin

Resolution: invalid
Status: newclosed

You haven't even described what you want that to do. Please ask for help on a forum, the odds are that you already can do whatever you're asking that to do.

comment:3 Changed 7 years ago by Oleg <serovov@…>

I want to call several ajax requests and when it all will complete, then - call a callback.

I know about $.when(ajax1, ajax2), but when you don't know exactly amount of ajax request - you can not use .when.

comment:4 in reply to:  3 Changed 7 years ago by jaubourg

Replying to Oleg <serovov@…>:

I want to call several ajax requests and when it all will complete, then - call a callback.

I know about $.when(ajax1, ajax2), but when you don't know exactly amount of ajax request - you can not use .when.

Of course, you can use when:

var arrayOfAjaxRequests = [ ajaxReq1, ajaxReq2, ... ];

$.when.apply( $, arrayOfAjaxRequests );

comment:5 Changed 7 years ago by Oleg <serovov@…>

Irony: Of course i can use document.getElementById('id'), not $('#id').

But: var w = $.when(); $('img').each(function(){

w.when($.get('/', {img: $(this).attr('src')}));

});

w.then(<ajax callback>);

And you don't need to handle array of deferred objects. I think it will be useful.

Note: See TracTickets for help on using tickets.