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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:05:50+00:00 2026-05-13T09:05:50+00:00

I’ve been trying to grab the Digg rss feed and parse its contents into

  • 0

I’ve been trying to grab the Digg rss feed and parse its contents into a table as an intro to working with jQuery / XML. I took this webmonkey example and tried to customize it. Here is my js file:

    // File: readXML.js

// Start function when DOM has completely loaded 
$(document).ready(function(){ 

    // Open the students.xml file
    $.get("digg.com/rss/index.xml",{},function(xml){

        // Build an HTML string
        myHTMLOutput = '';
        myHTMLOutput += '<table width="98%" border="1" cellpadding="0" cellspacing="0">';
        myHTMLOutput += '<th>Title</th><th>PubDate</th><th>Description</th><th>Link</th>';

        // Run the function for each student tag in the XML file
        $('item',xml).each(function(i) {
            diggTitle = $(this).find("title").text();
            diggDate = $(this).find("pubDate").text();
            diggDesc = $(this).find("description").text();
            diggLink = $(this).find("link").text();

            // Build row HTML data and store in string
            mydata = BuildDiggHTML(diggTitle,diggDate,diggDesc,diggLink);
            myHTMLOutput = myHTMLOutput + mydata;
        });
        myHTMLOutput += '</table>';

        // Update the DIV called Content Area with the HTML string
        $("#ContentArea").append(myHTMLOutput);
    });
});



 function BuildDiggHTML(diggTitle,diggDate,diggDesc,diggLink){


    // Build HTML string and return
    output = '';
    output += '<tr>';
    output += '<td>'+ diggTitle +'</td>';
    output += '<td>'+ diggDate +'</td>';
    output += '<td>'+ diggDesc +'</td>';
    output += '<td>'+ diggLink +'</td>';
    output += '</tr>';
    return output;
}

And my HTML:

<html>
    <head>
        <title>JQuery Easy XML Read Example</title>
        <script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript" src="readXML.js"></script>
    </head>
    <body>
    <div id="ContentArea"></div>
    </body>
</html>

Basically, it doesn’t work: it just prints the table headers without any of the data. (I checked the example and the code before I modified it worked just fine.) So, basically, where am I going wrong??

EDIT

Here is the new code courtesy of andres (which still doesn’t work!)

// File: readXML.js

// Start function when DOM has completely loaded 
$(document).ready(function(){ 

    // Open the students.xml file
    $.get("http://feeds.digg.com/digg/popular.rss",{},function(xml){

        // Build an HTML string

    myHTMLOutput = '<table width="98%" border="1" cellpadding="0" cellspacing="0">';
    myHTMLOutput += '<thead><th>Title</th><th>PubDate</th><th>Description</th><th>Link</th></thead>';

  // Run the function for each student tag in the XML file
    myHTMLOutput += '<tbody>'
    $('item',xml).each(function(i) {


        // Build row HTML data and store in string
        myHTMLOutput += BuildDiggHTML(this);
    });
    myHTMLOutput += '</tbody></table>';

        // Update the DIV called Content Area with the HTML string
        $("#ContentArea").append(myHTMLOutput);
    });
});



 function BuildDiggHTML(el){

    // Build HTML string and return
    var output = '';

    output  = '<tr>';
    try { 
      output += '<td>'+ $(el).find("title").text() +'</td>';
      output += '<td>'+ $(el).find("pubDate").text() +'</td>';
      output += '<td>'+ $(el).find("description").text() +'</td>';
      output += '<td>'+ $(el).find("link").text() +'</td>';
    }catch(ex){
      output = '<td colspan="4">'+ex.description+'</td>';
    }        
    output += '</tr>';
    return output;
}

  • 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-13T09:05:50+00:00Added an answer on May 13, 2026 at 9:05 am

    "digg.com/rss/index.xml" redirects to "http://feeds.digg.com/digg/popular.rss", try to change the URL.

    JS + HTML:

    ...
    // Build an HTML string
    
        myHTMLOutput = '<table width="98%" border="1" cellpadding="0" cellspacing="0">';
        myHTMLOutput += '<thead><th>Title</th><th>PubDate</th><th>Description</th><th>Link</th></thead>';
    
        // Run the function for each student tag in the XML file
        myHTMLOutput += '<tbody>'
        $('item',xml).each(function(i) {
            // Build row HTML data and store in string
            myHTMLOutput += BuildDiggHTML(this);
        });
        myHTMLOutput += '</tbody></table>';
    ...
    
    
    function BuildDiggHTML(el){
    
        // Build HTML string and return
        var output = '';
    
        output  = '<tr>';
        try { 
          output += '<td>'+ $(el).find("title").text() +'</td>';
          output += '<td>'+ $(el).find("pubDate").text() +'</td>';
          output += '<td>'+ $(el).find("description").text() +'</td>';
          output += '<td>'+ $(el).find("link").text() +'</td>';
        }catch(ex){
          output = '<td colspan="4">'+ex.description+'</td>';
        }        
        output += '</tr>';
        return output;
    }
    

    EDIT:

    jQuery Ajax Cross-Domain

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

Sidebar

Related Questions

No related questions found

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.