I am having issues with some xml parsing. I want the data to be output as such:
<ul id="schedule">
<li><span class="title">Title</span>
<span class="date">Date</span>
<span class="desc">Description</span>
</li>
</ul>
and the jquery
$(document).ready(function()
{
$.ajax({
type: "GET",
url: "xml/schedule.xml",
dataType: "xml",
success: parseXml
});
function parseXml(xml)
{
$(xml).find('item').each(function() {
var title = $(this).find('title').text();
var date = $(this).find('date').text();
var desc = $(this).find('description').text();
$('#schedule').append($('<li><span class="'title'">' + title + '</span>' + ***the other elements i can't escape the 's***</li>'));
});
}
});
and finally the xml
<?xml version="1.0" encoding="utf-8"?>
<schedule>
<item>
<title>Event Name</title>
<date>18 Jan 2012 09:00 MST</date>
<description>Aliquam et nisl vel ligula consectetuer suscipit. Morbi euismod enim eget</description>
</item>
</schedule>
I know this is simple but it’s driving me crazy. Thanks!
try this
html content
jquery