Lost with Ajax loading XML file

Lost with Ajax loading XML file

Hi there!

I'm trying to load & read directly with jQuery.ajax an XML file.
Here is the code I'm using:
  1. function readXMLNews(xml)
  2. {
  3.    $(xml).find('news').each(function(){
  4.       
  5.       var $newsHeader = $('div#newsHeader');
  6.       var $newsBody = $('div#newsBody');
  7.       var $newsFoot = $('div#newsFoot');
  8.       
  9.       var $nodeHead = $(this).find('header');
  10.       var $nodeBody = $(this).find('body');
  11.       var $nodeDate = $(this).find('date');
  12.       var $nodeBy   = $(this).find('by');
  13.       
  14.       $newsHeader.text($nodeHead.text());
  15.       $newsBody.text($nodeBody.text());
  16.       $newsFoot.text('By: ' + $nodeBy.text() + ' - ' + $nodeDate.text()); 
  17.    });
  18. }

  19. $(document).ready(function(){
  20.    $.ajax({
  21.       type: "GET",
  22.       url: '../news/20120901.xml',
  23.       dataType: 'xml',
  24.       success: function(xml){readXMLNews(xml)},
  25.       error: alert('error')
  26.    });
  27. });

- I didn't know it was imposible, so far I wouldn't had achieved it. -