JQUERY has a very useful function .get() to fetch a file and render this. Let's take a look at the function.
I am using this code at localhost
$('#post6').click(function() {
$.get('atom.xml', function(data) {
$('#ajaxpost6').empty();
$(data).find('entry').each(function() {
var $entry = $(this);
var html = '
';
html += $entry.find('title').text();
html += '
';html += $entry.find('title').text();
html += '
$('#ajaxpost6').append(html);
});
});
return false;
});
when I click the post6 button it the get function returns a xmlHTTPrequest and if the request is successful it executes the second argument function.
And using the callback function I can render the data for my need. I can filter the data from the xml using the jquery's dom manipulation methods.