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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:31:57+00:00 2026-06-03T03:31:57+00:00

I know there are multiple plugins out there however I wonder how I can

  • 0

I know there are multiple plugins out there however I wonder how I can make my own thing work the way I want.

First off, when scrolling to the bottom of my page I want to trigger a function called ajaxLoadActivity which is now triggered with a “Show More” button.

$(window).scroll(function() {

            if ( $(window).scrollTop() >= ( $(document).height() - $(window).height() ) )

                if ( $('ol.astream > .loadCount:last > li').attr('id') == "noMoreActivities" )
                    return false;

                ajaxLoadActivity('bottom', true);
                console.log('fired');

        });

I have the problem that probably everybody encounters when trying to do this himself. The problem is that the function is fired multiple times. The function ajaxLoadActivity does all the ajax stuff and appends <li> items to an existing <ol>. The function works perfect when just using it with the “Show More” Button.

However I wonder how I can trigger the same function when simply scrolling to the bottom of the page. But I want to call it only once – then wait till the stuff is loaded – and only then allow the function to be fired again if the bottom is reached again.

And I have an exception that is already in my sample code above … if my last element has an id of noMoreActivities I don’t want the function to be fired again, because then there are no more activities.

Any ideas how I can fire the function only once and wait till the request happend?

  • 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-03T03:31:59+00:00Added an answer on June 3, 2026 at 3:31 am

    Assuming you’re using $.post you can return it in your ajaxLoadActivity function then check to see if it’s running

    var ajax;
    
    $(window).scroll(function() {
    
        if ( $(window).scrollTop() >= ( $(document).height() - $(window).height() ) )
    
            if ( $('ol.astream > .loadCount:last > li').attr('id') == "noMoreActivities" )
                return false;
    
            if (ajax) {
    
                return false; // don't make another request, let the current one complete, or
                // ajax.abort(); // stop the current request, let it run again
            }
    
            ajax = ajaxLoadActivity('bottom', true);
            console.log('fired');
    
    });
    
    function ajaxLoadActivity(one, two) {
    
        return $.post(/* stuff */);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that there can be multiple values for an email, but I'm not
I know a great thing about perl is that there's multiple ways of doing
I'm trying to understand how modal windows work. I know, there are multiple plug-ins
I know there are multiple solutions online, but some are for windows, some are
I know there has to be a way: I need help getting any hot
I know there is ongoing work for in this regards but what is the
I want to implement encryption as there are multiple people with access to the
I know there is a lot of controversy (maybe not controversy, but arguments at
I know there is a very similar question here but I was hoping to
I know there is a lot of talk about BPM these days and I

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.