Skip to main content

Bug Tracker

Side navigation

#12402 closed feature (invalid)

Opened August 26, 2012 02:17PM UTC

Closed August 26, 2012 02:21PM UTC

Last modified August 27, 2012 05:14AM UTC

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

Reported by: serovovo@gmail.com 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!

Attachments (0)
Change History (5)

Changed August 26, 2012 02:19PM UTC by serovov@gmail.com comment:1

Just posting this comment to trak this issue.

Changed August 26, 2012 02:21PM UTC by dmethvin comment:2

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.

Changed August 26, 2012 02:42PM UTC by Oleg <serovov@gmail.com> comment:3

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.

Changed August 26, 2012 02:45PM UTC by jaubourg comment:4

Replying to [comment:3 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 );

Changed August 27, 2012 05:14AM UTC by Oleg <serovov@gmail.com> comment:5

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.