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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:10:38+00:00 2026-06-07T03:10:38+00:00

Hi im currently developing this site: http://remedia-solutions.com/clientes/0039_kiplingmexico/demo2/ its almost done but im currently having

  • 0

Hi im currently developing this site:

http://remedia-solutions.com/clientes/0039_kiplingmexico/demo2/

its almost done but im currently having some troubling on a section “Coleccion” in this section the first thing you do is select a specific type of bags , once you select it, you will get only 20 bags loaded (this bags are loaded from a mysql db) when you get to the bottom of the page it will show another 20 bags. Now the problem here is that when i get to the bottom the JS function runs like 5 times :/ So is there a way it only run once then wait a bit and run it again?

Heres my Jquery code

Once you click a “Coleccion” it will do this:

$("#coleccionmenu span").click(function() {
        $("#coleccionmenu span").removeClass('focuscoleccion')
        $(this).addClass('focuscoleccion');
        $("#contbolsas").fadeOut('fast')
        var id = this.id;

        $.ajax({
          url: "respuestabolsas.php",
          type: "POST",
          data: "id=" + id,

          complete: function() {
            //called when complete
          },

          success: function(x) {
            $("#contbolsas").css("display", "none");
            $("#contbolsas").html(x)
            $(".bolsacargada").css('opacity', '0');
            $("#contbolsas").css("display", "block");
            $(".bolsacargada").each(function(index) {
                $(this).delay(300*index).animate({opacity: 1}, 400);
            });
           hovercolores();
           if ($('#contbolsas > div:contains("Rawr")').length > 0) {
            $("#text").fadeOut()
            return false;
            }
            else{
                $("#text").fadeIn()
               cargamascoleccion(id)
            }




            },

          error: function() {
            //called when there is an error
          },
        });


});

Once is loaded i need the id from the collection you just clicked so when you scroll down it only show those collections and not the other ones:

function cargamascoleccion(id){




        $("#todocoleccion").scroll(function() {



            var bottom = $("#todocoleccion").scrollTop() - $(window).height();

            if( bottom > $(".bolsacargada:last").offset().top + 300 ){

                $.ajax({
                  url: "respuestabolsas2.php",
                  type: "POST",
                  data: "id=" + id + "&idultimabolsa=" + $(".bolsacargada:last").attr('id'),

                  complete: function() {
                    //called when complete
                  },

                  success: function(x) {
                    hovercolores();
                   if(x != ""){

                        $("#contbolsas").append(x)


                   }
                    else{
                        $("#text").fadeOut()
                        return false;
                    }   

                 },

                  error: function() {
                    //called when there is an error
                  },
                });
            }
            });


        }

I doubt theres a problem on the php code i think the problem is on the function above cause it runs like 4 times when i get to the offset of the last bag. Any ideas?

  • 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-07T03:10:40+00:00Added an answer on June 7, 2026 at 3:10 am

    It looks like its firing the ajax call multiple times because the condition is met multiple times while the user is scrolling. You might want to add another condition to the if statement before executing the ajax call which checks whether it has already been initiated. Something along the lines of

    var ajaxComplete = true;
    $("#todocoleccion").scroll(function() {
    
    
    
        var bottom = $("#todocoleccion").scrollTop() - $(window).height();
    
        if (bottom > $(".bolsacargada:last").offset().top + 300 && ajaxComplete) {
    
            $.ajax({
                url: "respuestabolsas2.php",
                type: "POST",
                data: "id=" + id + "&idultimabolsa=" + $(".bolsacargada:last").attr('id'),
                beforeSend: function() {
                    ajaxComplete = false
                },
                complete: function() {
                    //called when complete
                    ajaxComplete = true;
                },
    
                success: function(x) {
                    hovercolores();
                    if (x != "") {
    
                        $("#contbolsas").append(x)
    
    
                    }
                    else {
                        $("#text").fadeOut()
                        return false;
                    }
    
                },
    
                error: function() {
                    //called when there is an error
                },
            });
        }
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So im currently developing this site: http://remedia-solutions.com/clientes/0039_kiplingmexico/demo2/ its almost done but im currently having
Im currently developing this site http://digitalgenesis.com.au/projects/sister/music.html What happens when i re-size screen is that
I'm currently developing a site ( http://landscaping.jvsoftware.com/ ) but I'm having some strange problems
Currently I'm developing a flight ticket search engine(pretty similar to this-http://www.momondo.com/) which will gather
http://support.microsoft.com/kb/276505 This site has a download for a Win32 application wizard. I am currently
Im currently developing this site so none of the content on there is actually
Im currently developing this site so none of the content on there is actually
Currently developing this site and I can't pin point as to why there is
This is my first WordPress 3 site. I'm currently developing a site for a
I am currently developing a site for a client (http://184.168.136.225/). Having some issues with

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.