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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:37:47+00:00 2026-05-28T13:37:47+00:00

I am parsing an XML file into a table and want to use the

  • 0

I am parsing an XML file into a table and want to use the jquery tablesorter. Now that I’ve got the error to go away for tablesorter not existing, my data is populating in the table but the headers are not able to be sorted. Any ideas? Code is listed below for JS and HTML.

HTML:

<html> 
<head> 
    <title>Read XML</title> 
    <script type="text/javascript" src="jquery-1.7.1.js"></script>  
    <script type="text/javascript" src="jquery.tablesorter.js"></script> 
    <script type="text/javascript" src="custom.js"></script> 
</head> 
<body> 
    <table id="table" border="1"> 
        <thead> 
            <tr> 
                <th>Item #</th> 
                <th>Shape</th> 
                <th>Weight</th> 
                <th>Color</th> 
                <th>Clarity</th> 
                <th>Price($)</th> 
           </tr> 
        </thead> 
        <tbody> 
        </tbody> 
    </table> 
</body> 
</html> 

JS:

$(document).ready(function() { 
$("#table").tablesorter(); 
$.ajax({ 
     type: "GET", 
     url: "tutorial.xml", 
     dataType: "xml", 
     success: parseXml 
}); 
$("#table").trigger("update"); 
}); 

function parseXml(xml) 
{ 
    $(xml).find("diamond").each(function() 
    { 
        $("#table tbody").after("<tr><td>" + $(this).find("id").text() +  
        "</td><td>" + $(this).find("shape").text() + "</td><td>" + $(this).find("weight").text() +  
        "</td><td>" + $(this).find("color").text() + "</td><td>" + $(this).find("clarity").text() +  
        "</td><td>" + $(this).find("price").text() + "</td></tr>"); 
    }); 
} 
  • 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-28T13:37:48+00:00Added an answer on May 28, 2026 at 1:37 pm

    Move this line:

    $("#table").trigger("update");
    

    to the end of the parseXML method, and change .after to .append

    function parseXml(xml) 
    { 
        $(xml).find("diamond").each(function() 
        { 
            $("#table tbody").append("<tr><td>" + $(this).find("id").text() +  
            "</td><td>" + $(this).find("shape").text() + "</td><td>" + $(this).find("weight").text() +  
            "</td><td>" + $(this).find("color").text() + "</td><td>" + $(this).find("clarity").text() +  
            "</td><td>" + $(this).find("price").text() + "</td></tr>"); 
        }); 
        $("#table").trigger("update");
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am parsing an XML file into a table and want to use the
I am parsing an xml file with jquery and ajax. I noticed that it
I have an XML file that I want to parse into a database in
I've used following code for parsing XML file in c++. http://www.codeproject.com/Articles/176236/Parsing-an-XML-file-in-a-C-C-program . Now I
I got a string from parsing a XML file which looks like this: Fri,
I am parsing an XML feed into a MYSQL table using simplexml_load_file(). Some of
Background: I am parsing a 330 meg xml file into a DB (netflix catalog)
Currently I am downloading and parsing my data from an XML file that is
I'm parsing an XML file into a list of coordinates, and this is the
I'm parsing an XML file and filling a table view. The XML has a

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.