noob help w XML input!
noob help w XML input!
I am new to jQuery and am looking for simple demo code to read in XML using the data table plug-in. I can't seem to find an exact example to match what I am needing.
Here is some XML to chew on. Thanks for anyone who can lend a noob a hand...
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <!-- Edited by XMLSpy®
-->
-
-
Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985
-
Bridge of Spies
T'Pau
UK
Siren
7.90
1987
-
Private Dancer
Tina Turner
UK
Capitol
8.90
1983
-
Midt om natten
Kim Larsen
EU
Medley
7.80
1983
-
Pavarotti Gala Concert
Luciano Pavarotti
UK
DECCA
9.90
1991
-
The dock of the bay
Otis Redding
USA
Atlantic
7.90
1987
-
Picture book
Simply Red
EU
Elektra
7.20
1985
-
Red
The Communards
UK
London
7.80
1987
-
Unchain my heart
Joe Cocker
USA
EMI
8.20
1987
Here is some XML to chew on. Thanks for anyone who can lend a noob a hand...
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <!-- Edited by XMLSpy®
-->
-
-
Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985
-
Bridge of Spies
T'Pau
UK
Siren
7.90
1987
-
Private Dancer
Tina Turner
UK
Capitol
8.90
1983
-
Midt om natten
Kim Larsen
EU
Medley
7.80
1983
-
Pavarotti Gala Concert
Luciano Pavarotti
UK
DECCA
9.90
1991
-
The dock of the bay
Otis Redding
USA
Atlantic
7.90
1987
-
Picture book
Simply Red
EU
Elektra
7.20
1985
-
Red
The Communards
UK
London
7.80
1987
-
Unchain my heart
Joe Cocker
USA
EMI
8.20
1987
This discussion has been closed.
Replies
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Reading XML with jQuery
#page-wrap
{
border:solid 1px #FF66FF;
margin: 10px 5px 10px 0;
padding: 5px 10px;
width: 500px;
}
@import "demo_page.css";
@import "demo_table.css";
$(document).ready(function(){
$.ajax({
type: "GET",
url: "cd_catalog.xml",
dataType: "xml",
success: function(xml) {
var html = 'ArtistSong';
$(xml).find('CD').each(function(){
var cd = $(this).attr('CD');
var artist = $(this).find('ARTIST').text();
var title = $(this).find('TITLE').text();
html += ''+artist+''+title+'';
});
html+='';
$('#page-wrap').append($(html));
}
});
$('#tableid').dataTable( {
"sPaginationType": "full_numbers"
} );
});
Reading XML with jQuery
Allan