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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:13:30+00:00 2026-06-18T02:13:30+00:00

I’m having trouble figuring out an efficient way to update a column in an

  • 0

I’m having trouble figuring out an efficient way to update a column in an html table without reloading the entire table. The table is a list of player stats, all of which are stored on my MYSQL database and loaded into the table except for the last column. The data in last column of the table comes from an XML file. There is a select drop down on the page that when the user changes it, I need the page to do some calculation on the XML data and reload only the last column of the table without having to make an AJAX call and reload the entire stats table. Currently I reload the entire table which is quite slow. This is how I am generating the table:

echo '<table name="currentTable" id="battersTable">
                <thead>
                    <tr>
                        <th>&nbsp </th>
                        <th>NAME</th>
                        <th>AGE</th>
                        <th>
                            <select class="posSelect" onchange="posSelect(this.value, this.parentNode.parentNode.parentNode.parentNode)">
                                <option value="ALL">POS: ALL</option>
                                <option value="C">POS: C</option>
                                <option value="1B">POS: 1B</option>
                                <option value="2B">POS: 2B</option>
                                <option value="SS">POS: SS</option>
                                <option value="3B">POS: 3B</option>
                                <option value="MI">POS: MI</option>
                                <option value="CI">POS: CI</option>
                                <option value="OF">POS: OF</option>
                            </select>
                        </th>
                        <th>TEAM</th>
                        <th>AB</th>
                        <th>R</th>
                        <th>HR</th>
                        <th>RBI</th>
                        <th>SB</th>
                        <th>AVG</th>';
                        if($draftType == 0){
                            echo '<th>ADP</th>
                        <th id="chance">CHANCE</th>';
                        }else if($draftType == 1){
                            echo '<th>$</th>';
                        }
                    echo'</tr></thead>
            <tbody id="replacebatters">';

while($row = mysqli_fetch_array($resultbat, MYSQLI_ASSOC))
  {     
    if(array_key_exists($row['NAME'], $crossed)){
        echo "<tr class='drafted' id='" . $row['NAME'] . "'>";
    }else if(array_key_exists($row['NAME'], $rostered)){
        echo "<tr class='roster' id='" . $row['NAME'] . "'>";
    }else if($n&1){
        echo "<tr id='" . $row['NAME'] . "'>";
    }else{
        echo "<tr class='alt' id='" . $row['NAME'] . "'>";
    }

  echo '<th>Draft</td>';
  echo '<td>' . $row['NAME'] . "</td>";
  echo "<td>" . $row['AGE'] . "</td>";
  echo "<td>" . $row['POS'] . "</td>";
  echo "<td>" . $row['TM'] . "</td>";
  echo "<td>" . $row['AB'] . "</td>";
  echo "<td class='runs'>" . $row['R'] . "</td>";
  echo "<td class='hr'>" . $row['HR'] . "</td>";
  echo "<td class='rbi'>" . $row['RBI'] . "</td>";
  echo "<td class='sb'>" . $row['SB'] . "</td>";
  echo "<td class='avg'>" . $row['AVG'] . "</td>";
if ($draftType == 0)
{
    $player = $MDCxml->xpath('//player[@name="' . $row['NAME'] . '"]');
    if (is_array($player) && count($player)) {
        $player = $player[0];
    } else {
        continue; // not found
    }

    $attr = $player->attributes(); 

    $adp = (float) $attr['adp'];
    $early = (int) $attr['early'];      

    $stdev = -0.42+0.42*($adp-$early);

    if($stdev<0)
        $stdev = 1;
    $chance =number_format(((1-NORMDIST($pickNumber,$adp,$stdev,TRUE))*100), 0);

    echo "<td class='adp'>".$adp."</td>";
    echo "<td class='odds'>".$chance."%</td>";
}elseif ($draftType == 1){
    echo "<td class='dollar'>$14</td>";
}     
  echo "</tr>";
  $n = ++$n;
  }
echo "</tbody></table>";

On change of the drop down below I need to update the $pickNumber (round selected * a stored pick number) variable with the current round the user has selected and update the values in the CHANCE column with the newly calculated $chance variable. Here is the drop down select:

echo "Current Round: ";
    echo "<select id='round' size='1' onchange='***NOT SURE WHAT TO DO HERE***'>";

    for($q = 1; $q <= $rosterSizeRow['roster_size']; $q++)
    {
        if ($q == $_GET['round'])
        {
            echo "<option value=".$q." selected> ".$q." </option>";
        }else{
            echo "<option value=".$q."> ".$q." </option>";
        }
    }
    echo "</select>";

Thanks in advance.

  • 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-18T02:13:31+00:00Added an answer on June 18, 2026 at 2:13 am

    You can see XMLHttpRequest for reference documentation. On the same page, the see also section has several links on how to use XMLHttpRequest and how to make AJAX calls.

    For a start, you can look at this untested code

    HTML:

    <div>
        <label for="round">Round:</label>
        <select id="round" name="round" onchange="ajaxUpdateChance(this)">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3" selected>3</option>
            <option value="4">4</option>
        </select>
    </div>
    

    jQuery:

    function updateChance(data)
    {
        var table = $('#battersTable');
        $('.odds', table).each(function(index, element) {
                                   $(element).text(data[index] + '%');
                               });
    }
    
    function ajaxUpdateChance(el) {
        var round = el.value;
        $.ajax({ url: 'http://www.example.com/update_chance.php',
                 data: { round: round },
                 dataType: 'json',
                 success: updateChance });
    }
    

    ajaxUpdateChance retrieves the data for the odds column. updateChance iterates through the odds column entries and sets the new text from the data array. The data array should be a JSON array.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I know there's a lot of other questions out there that deal with this
i got an object with contents of html markup in it, for example: string
I have thousands of HTML files to process using Groovy/Java and I need to

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.