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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:04:44+00:00 2026-05-28T01:04:44+00:00

This question is trying to confirm my understanding and how best to solve the

  • 0

This question is trying to confirm my understanding and how best to solve the situation at hand.

In my application, let say I have five containers and each of these containers has its own data source URL.

Upon loading of the page, all five need to ask the server, retrieve the data and display it.

Currently, as soon as the page is loaded, I fire the jquery ajax.post method for each of the containers in a loop. The loop executes instantly and in Firebug I see all these ajax requests as “processing”

Now my understanding is that javascript is single threaded so all of these ajax requests are still somewhere in the browser’s execution queue, right?

What I want is that even though I fired all the 5 ajax post requests in a loop, it should hit the server only one after the other.

For e.g 1st Ajax call success or failure –> Call 2nd ajax post –wait for success or failure and then fire the third ajax post and so on.

I don’t want to hit the server with 5 parallel ajax calls so I want to confirm that the ajax.post for all those 5 containers in a loop is not a parallel operation.

If for any reason there is a chance of some browser doing parallel requests then I would like to implement a simple chaining mechanism which I can do it using the call back function of each ajax post.

I looked at the jquery queue function but the calls are q’d for the same object. In my case I need to call same function on different objects in a sequential manner.

If you can tell me what is the best practice, and whether my assumptions and understanding needs corrections.

Thank you

  • 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-28T01:04:45+00:00Added an answer on May 28, 2026 at 1:04 am

    You could also use recursion—something like so…

    function chainContent(container) {
        $.ajax({
            url: container.data('url'),
            success: function(html) {
                container.html(html);
                var next = container.next();
                if (next != null) chainContent(next);
            }
        });
    }
    
    loadContent($('#container_1'));
    

    And the HTML…

    <div id="container_1" data-url="load_1.htm"></div>
    <div id="container_2" data-url="load_2.htm"></div>
    <div id="container_3" data-url="load_3.htm"></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello i have this question i was trying to find a way to call
Following on from this question...I'm trying to unit test the following scenario: I have
Following up from this question , I'm trying to implement an unobtrusive confirm dialog.
While trying to answer this question I found that the code int* p =
While trying to answer this question I found without () (which invokes C++ most
This question is related to the one I asked here . I'm trying to
I am trying to integrated linkedIn using this question answer Posting LinkedIn message from
This question is in continuation to my previous question . I am trying to
(Came up with this question in the course of trying to answer this other
I asked this question earlier and am now trying to explore the idea of

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.