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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:55:47+00:00 2026-06-13T01:55:47+00:00

Possible Duplicate: Wait until all jquery ajax request are done? I have an array

  • 0

Possible Duplicate:
Wait until all jquery ajax request are done?

I have an array with an N size. Each element of the array needs to loaded via ajax using jquery. I have the loading logic complete, I am just trying now to figure out how to load only 10 (formula should be able to handle changing this value) at a time, when the 10 items complete loading via ajax, load the next 10. Here is my example.

I have 100 elements of an array, the first 0-9 items need to be loaded, when those 10 items are done, 10-19, then 20-29 and etc. I am trying to get this to be efficient as possible, thanks for any help.

Though this may be totally off, I am hoping I am getting my point across to receive any help.

//Formula calculation
while(wait till count is complete){

}
function LoadBatch(array){
$.each(array,function(i,item){
$.ajax({
success:function(){
//Maybe a counter here to let loop know when to kick off next batch.
}
});
});
}
  • 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-13T01:55:48+00:00Added an answer on June 13, 2026 at 1:55 am

    Using a control flow library will make your life easier. Aysnc.queue() looks appropriate. It’ll make sure no more than 10 requests are active at once. It won’t wait for the previous 10 to finish before starting the next load. This should minimize load time while limiting concurrent requests.

    Here’s an example:

    var results = [];
    var concurrency = 10;
    
    var q = async.queue(function (task, done) {
      var item = task.item;
      $.ajax({
        success: function(result) {
          // Store results in array with indicies matching the original array.
          // If you don't care about the order of the results you could just 
          // push them on.
          results[task.index] = result;
          done();
      });
    }, concurrency);
    
    // push all the array items into the queue, keeping track of the index
    $.each(array, function(i, item) {
      q.push({
        index: i,
        item: item
      });
    });
    
    // drain will be called when all the requests are done
    q.drain = function() {
      console.log(results); // results has all the responses
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: C# Spawn Multiple Threads for work then wait until all finished I
Possible Duplicate: how to wait until the textbox enable in watin i have one
Possible Duplicate: Wait until file is unlocked in .NET I have an open file,
Possible Duplicate: jQuery Ajax always returns “undefined”? I'm trying to come up with a
Possible Duplicate: PHP get all arguments as array? Within a javascript function arguments always
Possible Duplicate: How can I make the browser wait to display the page until
Possible Duplicate: why a[n] is accepted in c during runtime? Declaring the array size
Possible Duplicate: php exec command (or similar) to not wait for result I have
Possible Duplicate: jquery or css selector? select all id’s that start with I need
Possible Duplicate: raw_input and timeout raw_input() will wait for user input. How to make

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.