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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:12:55+00:00 2026-05-17T17:12:55+00:00

Alright there’s two ways this can go. One is from the presentation side, and

  • 0

Alright there’s two ways this can go. One is from the presentation side, and one is from the “processing” side.

Right now I have a table of data set up. Certain actions (typing a search query, clicking a different page number, etc…) trigger a function called refreshData()

refreshData() first calls showOverlay() which fades in an overlay with a loading.gif image. Then it does a $.post() request to get some json data. Then with success it calls hideOverlay() which fades out the overlay.

function refreshData()
    {
        showOverlay();
        var parameters = {'page' : '1', 'per-page' : '5'};
        $.post(updateUrl, parameters,
            function(data){
                $('#data-container table tbody').empty();
                $.each(data.users, function(i, user){
                    $('#data-container table tbody').append('<tr>'+
                    '<td>'+ user.name +'</td>'+
                    '<td>'+ user.registered +'</td>'+
                    '<td>'+ user.id +'</td>'+
                    '<td><a href="/users/edit/' + user.id + '">edit</a></td>'+
                    '</tr>'
                    );
                });
                alternateRows();
                hideOverlay();
        }, "json");
    }

My first issue (presentation) is that if refreshData() is called repeatedly, the overlay fades in and out over and over. It gets stacked up so that even if the user is doing nothing it will fade in and out until it has done as many times as actions occurred. I’d like if it only faded out if the most recent “request” finished.

My second issue (processing) might not even matter. I’m wondering if before “appending” new items to the DOM, I should check if there’s a new request yet. If there is there’s no point in adding things just to remove them. Is this important enough? And if it is how should I do that?

  • 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-17T17:12:56+00:00Added an answer on May 17, 2026 at 5:12 pm

    I don’t know what your showOverlay() function looks like, but you could do something like this:

    function showOverlay()
    {
      if($('#overlay :animated').length > 0 || $('#overlay').hasClass('visible'))
      {
          return;
      }
      //Show overlay
    }
    

    :animated

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

Sidebar

Related Questions

Alright guys, I'm sure there is a simple solution to this problem. I have
Alright, so I have a base class which we'll call TFruit . From this
Alright, we have two database servers, one is owned by us, one owned by
Alright thought I would throw this one out there for the crowd to think
Alright, I have been breaking my head over this one for more than a
Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
Alright everyone, is there a way to have 2 divs taking up 50% of
Alright, I know there's a simple way to do this, but it's been years
Alright, I have some weird behavior and this question goes to the people out

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.