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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:02:00+00:00 2026-05-11T17:02:00+00:00

I have an AJAX application that downloads a JSON object and uses the data

  • 0

I have an AJAX application that downloads a JSON object and uses the data to add rows to an HTML <table> using Javascript DOM functions. It works perfectly… except in Internet Explorer. IE doesn’t give any sort of error, and I’ve verified as best as I can that the code is being executed by the browser, but it simply has no effect. I created this quick and dirty page to demonstrate the problem:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title></title></head><body>

<table id="employeetable">
    <tr>
        <th>Name</th>
        <th>Job</th>
    </tr>
</table>

<script type="text/javascript">
    function addEmployee(employeeName, employeeJob) {
        var tableElement = document.getElementById("employeetable");
        if (tableElement) {
            var newRow = document.createElement("tr");
            var nameCell = document.createElement("td");
            var jobCell = document.createElement("td");
            nameCell.appendChild(document.createTextNode(employeeName));
            jobCell.appendChild(document.createTextNode(employeeJob));
            newRow.appendChild(nameCell);
            newRow.appendChild(jobCell);
            tableElement.appendChild(newRow);
            alert("code executed!");
        }
    }

    setTimeout("addEmployee(\"Bob Smith\", \"CEO\");", 1000);
    setTimeout("addEmployee(\"John Franks\", \"Vice President\");", 2000);
    setTimeout("addEmployee(\"Jane Doe\", \"Director of Marketing\");", 3000);
</script>

</body></html>

I haven’t tried IE 8, but both IE 7 and IE 6 do not show the additional rows that are supposedly being added. I can’t fathom why. Does anyone know a good workaround to this problem, or am I perhaps doing something wrong?

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

    You need to create a TBODY element to add your new TR to and then add the TBODY to your table, like this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><head><title></title></head><body>
    
    <table id="employeetable">
        <tr>
            <th>Name</th>
            <th>Job</th>
        </tr>
    </table>
    
    <script type="text/javascript">
        function addEmployee(employeeName, employeeJob) {
            var tableElement = document.getElementById("employeetable");
            if (tableElement) {
                var newTable = document.createElement('tbody');   // New
                var newRow = document.createElement("tr");
                var nameCell = document.createElement("td");
                var jobCell = document.createElement("td");
                nameCell.appendChild(document.createTextNode(employeeName));
                jobCell.appendChild(document.createTextNode(employeeJob));
                newRow.appendChild(nameCell);
                newRow.appendChild(jobCell);
                newTable.appendChild(newRow);   // New
                tableElement.appendChild(newTable);   // New
                alert("code executed!");
            }
        }
    
        setTimeout("addEmployee(\"Bob Smith\", \"CEO\");", 1000);
        setTimeout("addEmployee(\"John Franks\", \"Vice President\");", 2000);
        setTimeout("addEmployee(\"Jane Doe\", \"Director of Marketing\");", 3000);
    </script>
    
    </body></html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using asp.net MVC to develop an application that will have ajax interactions.
I have a small AJAX application, written in PHP that I did not secure
I have a small ajax application built with php. Using phpMyAdmin I have set
I have coded some JavaScript to perform an ajax call in an asp.net application.
I have a script that appends some rows to a table. One of the
I have an AJAX application which has used CSS divs to create panels on
I have a basic ajax application, which will not work, instead the php code
I had a realtivley simple ajax application, which I have broken up to be
I have an application in which most requests are submitted via AJAX, though some
Several of my ajax applications in the past have used GET request but now

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.