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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:36:34+00:00 2026-06-08T12:36:34+00:00

I have the following code: $(‘#remove-commercial-products-modal’).find(‘form’).submit(function() { var promises = []; var $modal =

  • 0

I have the following code:

$('#remove-commercial-products-modal').find('form').submit(function() {                              
    var promises = [];
    var $modal = $(this).closest('.modal');                                                          

    $(this).find('input:checkbox:checked').each(function() {                                         
        promises.push(                                                                               
            $.ajax({
                url: '/commercial/products/unclaim/' + $(this).val() + '/',                          
                dataType: 'json',                                                                    
                timeout: 10000,                                                                      
                cache: false                                                                         
            }));                                                                                     
    });                                                                                              

    $.when.apply($, promises).done(function(result) {                                                
        $modal.modal('hide');                                                                        
    });                                                                                              

    return false;                                                                                    
});

So, when my form is submitted, I collect the values of the checked checkboxes, and I created an array of promises, each of which is an $.ajax call.

My calls are executed, and the code in my .done function is executed.

However, I think that .done is expecting a number of arguments, one for each promise. But I don’t know how many I have in advance, and I was hoping for an array of results (each one being the response of the $.ajax call.)

Does anybody know if I can have my responses grouped?
Thanks!

  • 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-06-08T12:36:36+00:00Added an answer on June 8, 2026 at 12:36 pm
    $.when.apply($, promises).done(function() {
        var l = arguments.length,
            i,
            jqxhr;
    
        for( i = 0; i < l; ++i ) {
            jqxhr = arguments[i][2]; //The i:th jQXHR passed  
        }                                                              
    });     
    

    See docs

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

Sidebar

Related Questions

I have following code in a html form <select name=category class=input onchange=ShowTB(this,'suggest');> <option value=0
I have following code snipped: ... var tpc = new ThirtPartyClass(); tpc.ExecuteCommand(); tpc.ExecuteCommand(); ...
I have following code function Model(onChanged) { this.array = new Array(); this.onChanged = onChanged;
I have following code $("#in").datepicker({ minDate: 0, onSelect: function (dateText, inst) { dateText =
I have following code to find if row is selected, which is selected and
I have following code snippet in c#. var list = new List<string> { a,
I have following code snippet: self.xmlHttpReq = new XMLHttpRequest(); self.xmlHttpReq.onreadystatechange = function() { if(self.xmlHttpReq.readyState
I have following code that I creating a grid var store = Ext.create('Ext.data.ArrayStore', {
I have following code: div.accountPage div.acct-form.login div.acct-header Log-in form.loginForm.login input(id=username, type=text, name=User, placeholder=Username, value=)
I have following code. var mysql = require('mysql'); var connection = mysql.createConnection({ host :

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.