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

Related Questions

I have some jQuery code. I have called an Ajax function file, file.php, that
I have a form I am submitting using jQuery's ajaxSubmit function from the Forms
I have this jQuery which works fine $(li[id^='shop_id']).click( function () { alert(I clicked on
I have created a function outside of $(document).ready() , but am still using jQuery
I have some jQuery/JavaScript code that I want to run only when there is
I have a jQuery datepicker that I want to restrict non work days -
I have a script that appends some rows to a table. One of the
Say I have jquery code like this: html += '<div class=index>' + item.index +
I'm struggling to find the right terminology here, but if you have jQuery object...
I have found jQuery to be a great tool to simplify my MVC Views.

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.