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

  • Home
  • SEARCH
  • 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 1098351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:34:03+00:00 2026-05-17T00:34:03+00:00

I have a jquery function that takes the data from the 3rd column of

  • 0

I have a jquery function that takes the data from the 3rd column of a table – runs a function on it – and then replaces the field with the result.

Here’s my code:

function getData() {

    $('#tab1_response').html("<img src='images/ajax-loader.gif' border=0> Please wait...").show();

    $('#myTable tr').each(function(index){
        var col1 = $(this).children('td.col1').text();
        $(this).children('td.col3').load('doStuff.php?url='+col1);
    });

    $("#myTable").trigger("update");
    $('#tab1_response').fadeOut(2000);
}

For some reason the last two lines:

$("#myTable").trigger("update");
$('#tab1_response').fadeOut(2000);

Don’t wait for the .each(function… to complete before running…

Instead the “Please wait…” loader doesn’t appear and my table doesn’t update meaning the new column isn’t sortable (I’m using tablesorter for jquery found here – http://tablesorter.com/docs/).

The function does otherwise work and I can see my 3rd column updating with new data.

Is there a simple fix for this???

I hope I’ve provided enough details but please let me know if you need more information 🙂

  • 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-17T00:34:03+00:00Added an answer on May 17, 2026 at 12:34 am

    You have to use the callback in .load(), but only when you hit the last row. Rewrite your code like this.

    function getData()
    {
      $('#tab1_response')
        .html("<img src='images/ajax-loader.gif' border=0> Please wait...")
        .show();
    
      var rows = $('#myTable tr').length;
    
      $('#myTable tr').each(function(index)
      {
        var tr   = $(this),
            col1 = tr.children('td.col1').text();
    
        if ( (index+1) === rows) //last row, use callback to update table and fade img
        { 
          tr.children('td.col3').load('doStuff.php?url=' + col1, function(){
            $("#myTable").trigger("update");
            $('#tab1_response').fadeOut(2000);
          });
        }
        else //
        {
          tr.children('td.col3').load('doStuff.php?url=' + col1);
        }
      });  
    }
    

    Warning I gave you an answer to your problem, but I’m with Dean Harding on the warning, doing one request per row is not a good idea. You should find a way to improve that (hint, use JSON 😉

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

Sidebar

Ask A Question

Stats

  • Questions 540k
  • Answers 540k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer my $ft_count = $str =~ tr/FT//; See perlop. If the… May 17, 2026 at 2:35 am
  • Editorial Team
    Editorial Team added an answer For i As Integer = 1 To 15 ddlAdults.Items.Add(new ListItem(i.ToString(),… May 17, 2026 at 2:35 am
  • Editorial Team
    Editorial Team added an answer You're trying to re-create the picker, instead set its options… May 17, 2026 at 2:35 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a WCF Service (called myservice.svc) that takes a message from a user
I have a WCF service that takes as a parameter a string value name.
Possible Duplicate: Can someone Explain this jQuery code? I have posted this before, but
At work, we have a report that is generated with IP's in it. There
Quick question, looking for some recommendations. I have a site that will be requesting
So basically I have a form with browser filters for data I'm displaying. I
I have a very specific problem and i'm looking for input on a good
I've got a bit of a problem with some jquery. The code works fine,
So I'm new to Ajax. I have an ASP.NET wizard panel wrapped in an
I created a function to take location input, pass it to Google Maps Javascript

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.