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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:41:33+00:00 2026-06-11T10:41:33+00:00

I have a page which loops through multiple unique id’s and, using ajax, loads

  • 0

I have a page which loops through multiple unique id’s and, using ajax, loads information into divs which correspond to rows in a database table. Because there are quite a few divs that need to be created and each div contains a considerable amount of information, this takes quite a while. What I would like to do is animate/show each div once it has been appended to the dom, allowing the loop to continue appending/showing more divs as they are created.

My code looks something like this:

// loop section unique IDs
$.each(uniqueIDs, function(key, uniqueID)
{

    // call AJAX synchronously
    // append resulting information to page

    // show newly appended div
    $("#" + uniqueID).slideDown();

});

The issue I am having is that the animations are very inconsistent. Sometimes the first div is animated while all subsequent divs are just shown without animation. Sometimes all divs are just shown without animation. I’m sure there has to be a more rigorous way to do this…

EDIT I have been calling ajax synchronously to keep the divs in proper order (otherwise the divs are appended to the dom in the order in which they complete). I’d be happy to find a solution using asynchronous ajax calls which preserve the original order.

  • 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-11T10:41:35+00:00Added an answer on June 11, 2026 at 10:41 am

    Use an array of $.Deffered objects for each asynchronous call, and then pass it to $.when(), whose .done() callback will only fire when all deferred objects are resolved, i.e., when all asynchronous operations are finished:

    var uniqueIDs = [1, 2, 3, 4];
    var $deferreds = [];            
    
    $.each(uniqueIDs, function (i, elem) {
        $deferreds.push(
          $.ajax({
            // options
          }).done(function (data) {
          })
        );
    });
    
    $.when.apply($, $deferreds).done(function () {
       console.log(arguments); // arguments will contain the result of each asynchronous call in order
    });
    

    Thus you can use that callback to animate your divs in order.

    Here’s a DEMO.

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

Sidebar

Related Questions

I have a page which displays my database information. Through each loop, there is
I have a page which loads and then I do some JQuery upon it.
I have a page which is Https, I am pulling some rss feeds using
I have one Page which is displaying details of some Client. I am using
I have a link on a page which generates a pdf. I am using
I have the following script which I am running. It loops through each table
I have a PHP page which looks through some HTML for links and replaces
I have a select box on a classic ASP page which looks like this:
I have page which is redirected from htaccess. now I can pass the German
I have this page which has three peson searchs on them. Basically it's a

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.