Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4007024
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:35:01+00:00 2026-05-20T08:35:01+00:00

Code example: http://jsfiddle.net/MhEPw/1/ I have two jQuery Deferred objects. I want to have more

  • 0

Code example: http://jsfiddle.net/MhEPw/1/

I have two jQuery Deferred objects.

I want to have more than one ‘async’ request happening – and after they all run I want the callbacks (the .done functions) to be run in order they were specified in. Unfortunately they don’t run in order.

Maybe I am looking for some functionality here that Deferred doesn’t provide?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:35:02+00:00Added an answer on May 20, 2026 at 8:35 am

    What you need to do is link all of your request with one master deferred object and register all of your callbacks on its promise. The master deferred object would need to listen to the individual requests and resolve accordingly. The simplest way to achieve this would be to define all of the deferred objects up front to avoid the chicken and egg problem:

    var d1 = $.Deferred();
    var d2 = $.Deferred();
    var def = $.when(d1, d2);
    
    def.done(function() {
        alert(1);
    });
    setTimeout(function() {
        d1.resolve();
    }, 3000);
    
    def.done(function() {
        alert(2);
    });
    setTimeout(function() {
        d2.resolve();
    }, 1000);
    

    Fiddle: http://jsfiddle.net/pVVad/

    Changing the order of deferred objects definitions is possible but it would make the example much more complicated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://jsfiddle.net/M6xdq/ What I want to achieve, is - when user clicks the read more
See this code example: http://jsfiddle.net/Z2BMK/ Chrome/IE8 look like this Firefox looks like this My
I have the following html: <!DOCTYPE html> <html> <head> <script src=http://code.jquery.com/jquery-latest.js></script> </head> <body> <span>not
I think it is best described by looking at an example: http://jsfiddle.net/kV9yn/16/ That is
i have a problem with the jquery getjson. This code works $.getJSON('http://twitter.com/status/user_timeline/USERNAME.json?count=10&callback=?', function(twitter_data) {
can anyone please suggest a good code example of vb.net/c# code to put the
Consider following SWT code example: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java?view=co How can I separate the inline defined class?
Example code: http://jsbin.com/eqile3/ This is a slider with 2 handles, 1 for min and
Here is an example code http://paste.ideaslabs.com/show/kmGATPRovx . How can I make the second block
Consider the following example code: http://code.google.com/apis/maps/documentation/javascript/examples/streetview-simple.html I can do scrollwheel: false on a mapOptions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.