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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:48:15+00:00 2026-05-24T11:48:15+00:00

I have a array.each function that calls a JSONP request for each item and

  • 0

I have a array.each function that calls a JSONP request for each item and injects code into the page from the JSONP feed.

However the items are being injected in the wrong order, aka different to the sequential order in the feed. I’m assuming this happens because the next item it run through the .each function before the first once finishes retrieving its feed and injects.

How can I force each “next” item to wait untill the previous one has finished?

var list = new Array("1","2","3","4","5");

Array.each(list, function(item)
{
    new request.JSONP..

    onComplete: function()
    {
        //inject code
    }
});

if the inject code output the numbers in the array it would be random every time:

2,4,5,1,3

I want it to be in order:

1,2,3,4,5

Hope that made sense, Thanks.

Using Mootools 1.3

  • 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-24T11:48:15+00:00Added an answer on May 24, 2026 at 11:48 am

    Welcome to event-driven programming.

    You need to fire each one off from the ‘onComplete’ of the one before, not try to fire them all off from the same piece of code. You could do that by making each one wait until a flag gets set by your onComplete, but it is much better to structure your code according to the events.

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

Sidebar

Related Questions

I have a script that runs through a multi-level array and each time calls
I have a JQuery's .each loop that calls a function with a parameter per
I have CSV data loaded into a multidimensional array. In this way each row
All, I have the following JSON Request that comes through a function call in
I have a search page that loads results. Each row has a Delete button
I have a function that takes a parameter(key) to retrieve it's value from a
I have a function that receives an array of Strings. These are the names
I have some ajax code that executes on mouseclick. It calls a file called
I have an array of FileReference objects which have several listeners attached to each
I have a 2-dimensional array of objects and I basically want to databind each

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.