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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:12:29+00:00 2026-06-16T17:12:29+00:00

I have a jquery loop, which i want to call and use ajax for

  • 0

I have a jquery loop, which i want to call and use ajax for each element in the loop.

var splitted = [1,2,3];
var categoriesID = [4,5,6];
$.each(splitted, function(index, val)
{
        $.ajax({
          type: "GET",
          url: 'index.php?act=ajax&op=showCategories&manufacturer='+val+'&categories='+categoriesID,
          success: function(data) {

            $(".manufacturer\\[" + val + "\\]").show();
            $(".manufacturer\\[" + val + "\\]").html(data);
            //alert('Load was performed.');

          }
        });

});

The problem is that i noticed that probably each element uses the same ajax connection, my results are the same – and of course for each element i should have gotten different results.

So – how i can close & re-open the ajax connection in every loop? OR is there another way to do so?

  • 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-16T17:12:31+00:00Added an answer on June 16, 2026 at 5:12 pm

    Better to use plain js to make a simle loop, and use jquery ajax to simplify ajax call to server. And for the same(bad) result that you are reciving from the server, my opinion is that you are sending or not sending the same params and then recieving same result, can you provide logic of getting the data… Ajax is asynchronous as the name says. So there is no need for open close connections, they are done in a parallel matherr. And jquery will take care of open/close. Also take a look at how to ask a question

    for (var i = 0; i < 3; i++) {
    
        $.ajax({
            type: "POST",
            data: i, //0,1 and 2
            url: myUrlString,
            success: function (data) {
    
                console.log(data);
            }
        });
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an .each loop in jQuery. I want to iterate the loop one
I have an ajax call in jQuery which returns a set of values: p1,
I have a jQuery Animation which I want to loop infinitely, I have the
I have a foreach loop in jQuery going through each 'div.panel', I need to
I have jQuery load asset on my layout and I want to use CHtml::ajaxButton/ajaxSubmitButton
I have an a JQuery array , which I want to pass on to
I want to loop thru a file which is loaded with ajax, but it
I want to to concatenate the results of a jquery each loop inside of
I have a loop which generates lot of input text fields with jquery. Now
I have a HTML Table which in which i want to manipulate using JQuery

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.