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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:57:43+00:00 2026-06-09T08:57:43+00:00

I use JQuery Ajax to get a table’s content from sever, using code like

  • 0

I use JQuery Ajax to get a table’s content from sever, using code like this:

success: function(data)
{
    //once I get the data, remove the old content from table
    $('.tableBody').empty();

    // then repopulate the table
    $.each(data, function(key,val) {
        //process the data, add different icons, texts...,append it to my table
        showTable(key, val);
   });
}

This works fine. but the problem is the table has many rows, so it takes about 300 millisecond to re-populate, (the empty() only take about 10 millisecond), so for a brief moment, the table is blank.

Is there anyway that I can add some animation between "empty()" and "showTable()" to avoid the blank screen so that it’s seamless transition?

  • 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-09T08:57:44+00:00Added an answer on June 9, 2026 at 8:57 am

    After you receive your data in your AJAX callback (or even before that), show a loading animation, do your stuff, then show your form/table again.

    Kind of a basic example.. On click of submit, show the loading animation, hide the form. Do your stuff (AJAX request), then hide the loading animation, and show the form again.

    <img class="loading" src="http://www.link-to-loading-anim.com/loading.gif"/>
        <form method="post">
        <input value="Click Me" type="submit"/>
    </form>​
    

    The Javascript:

    // On dom ready, hide our loading animation
    $('img.loading').hide();
    
    // on form submit, show the animation,
    $('form').submit(function(e){
        e.preventDefault(); // we dont really need to submit the form!!
    
        // Show our loading animation
        $('img.loading').fadeIn();
    
        // Optional: Hide the form..
        $('form').hide();
    
        // Do something here.. (AJAX Request)
        // - Your success of AJAX request..
    
        // Hide the image loader on success.. (setTimeout used for demo purposes)
        setTimeout(hideImageLoader, 2000);
    
    });
    
    function hideImageLoader(){
        $('img.loading').fadeOut('slow', function(){
            $('form').show();
        }); 
    }
    ​
    

    Here is a JSfiddle for a basic loading animation example.

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

Sidebar

Related Questions

I use jQuery and AJAX to load content from links and forms into a
i have a question in JQuery..I m using $.ajax() in my code (Function 1)
I am trying to use jquery ajax to get data from a php file.
I'm looking to use jQuery's .load() or .get() functions to replace AJAX, I've got
I am using HMVC codeigniter. I am trying to use jquery ajax first time.
I use jQuery to do AJAX calls. But specialchars like ÆØÅ (danish letter) comes
I was wondering if it would be possible to use jQuery's ajax function to
I've found this code in the internet: $.tablesorter.addWidget({ id: memorizeSortOrder, format: function(table) { if
I am new to jQuery and I am using ajax request to get an
My jQuery code: function check_availability(){ //get the username alert(hai); var result =; var CompanyCode

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.