If you need to load XML data from a URL, you need to execute an AJAX request, it could be something like this:
$(function() {
$.ajax({
type: "get",
url: "http://yoursite.com/yourfile.xml",
dataType: "xml",
success: function(data) {
$("#show_table").html(data);
},
error: function(xhr, status) {
$("#show_table").html(status);
}
});
});
Keep in mind that if you use AJAX, you can put an XML file with the same domain name. Otherwise, you need to configure cross-origin resource sharing
(CORS).
Edition:
, td
. xml html.
var xml = "<shows><show><date>9/8</date><place>Toads Place</place><location>New Haven, CT</location><time>9PM</time></show></shows>"
$(function() {
$(xml).find('show').each(function() {
console.log(this);
var $show = $(this);
var date = $show.find('date').text();
var place = $show.find('place').text();
var location = $show.find('location').text();
var time = $show.find('time').text();
var html = '<tr><td class="bold">' + date + '</td><td class="hide">' + place + '</td><td>' + location + '</td><td class="bold">' + time + '</td></tr>';
$('#show_table').append($(html));
});
});
html , : http://jsfiddle.net/a4m73/
EDITED: xml URL
, , : http://jsfiddle.net/a4m73/1/