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

  • Home
  • SEARCH
  • 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

I think it is best described by looking at an example: http://jsfiddle.net/kV9yn/16/ That is
can anyone please suggest a good code example of vb.net/c# code to put the
I have come across an interesting code example that allows me to make DIV
Hey! I was looking at this code at http://www.gnu.org/software/m68hc11/examples/primes_8c-source.html I noticed that in some
The C# 3.0 spec has the following code example in section 10.6.1.3 Output parameters:
Is there good example code or a test project for explaining the Model–view–presenter (MVP)
here is my example code: Public Class Parent Private _TestProperty As String Private WithEvents
There is this example code, but then it starts talking about millisecond / nanosecond
Take the following code for example; if (Convert.ToString(frm.WindowState) == Minimized) Layout.WindowState = Maximized; else
When reusing code (for example, a Util library you created), do you add its

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.