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 7649925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:07:06+00:00 2026-05-31T11:07:06+00:00

I am using jQuery deferreds, and have noticed an odd behavior. See fiddle here:

  • 0

I am using jQuery deferreds, and have noticed an odd behavior.

See fiddle here: http://jsfiddle.net/wKTgP/1/

If I use $.when to call a set of promises

$.when(promise1, promise2)
    .progress(function (message1, message2) {
        alert(message1 + ' ' + message2);
    });

If promise1 sends a notification ‘hello’, and promise2 sends ‘world’, I get two message boxes:

‘hello undefined’

and

‘hello world’

The first notification obviously shows a message from promise1, and promise2 hasnt sent anything yet… but the SECOND notification makes me think that promise1 has sent ‘hello’ AGAIN, and promise2 is sending ‘world’ for the first time…

What’s the story with this?

  • 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-31T11:07:08+00:00Added an answer on May 31, 2026 at 11:07 am

    Keep in mind that, when you’re attaching a progress handler to a promise that already progressed, the callback is called immediately with the latest progress value:

    $.Deferred().notify( "hello" ).progress(function( value ) {
        console.log( value );
    });
    

    Will log “hello” immediately.

    Now, $.when returns a compound promise. So, everytime one of its components progresses, the compound promise progresses.

    Given that the latest notification value is kept “in memory” and that the compound promise returned by $.when progresses when one of its component progresses, then it makes perfect sense that the progress value should be the union of all of the joined promises progress values, even if and when only one progressed:

    [ "hello", undefined ]
    [ "hello", "world" ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using jQuery, how would you find elements which have a particular style (eg: float:
using jquery v1.3.2 and jQuery UI 1.7.1 I have 1 tab control with 3
Using jquery I have a clicking tab mechanism that are nothing but anchor tags
Using jQuery and given this <ul> <li> <a external=http://stackoverflow.com href=home.htm>Link 1</a> </li> <li> <a
So in using jQuery deferreds and $.when to load many objects in parallel. $.when(
Using jQuery Autocomplete, according to the docs you have to do the following to
Using jQuery validation plugin but it has no CSV validation. I have made an
Using jQuery, how can I: Have all checkboxes on a page turned checked on
using jQuery I have the following code: var selectedIdsArray = $(#selectId option:selected).map(function(){return this.value;}); var
Using jQuery and using the ajax function, what causes it to use the error

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.