d'oh ;-)
Thanks Mike
GC

On Jul 23, 1:53 pm, "Mike Alsup" <[EMAIL PROTECTED]> wrote:
> The problem with your "get" code is this line:
>
> $('/rss//item').each(function(){
>
> If you don't use a context argument, jQuery searches the current
> document for the requested elements.   You need to tell it that you
> want to find those elements in the XML DOM:
>
> $('/rss//item', data).each(function(){
>
> Mike
>
> On 7/23/07, GianCarlo Mingati <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi list,
> > i'm experimenting with jquery and xml.
> > I really can't understand the difference between $.ajax and $.get
>
> > If you bought the book 'learning jquery', for xml parsing they always
> > use, or suggest to use (in the examples, but i may wrong) the $.get
> > method to retrieve the contents of an xml file.
>
> > Why/*??*/ if i use $.get('http://www.corriere.it/rss/ultimora.xml',
> > function etcetera...) and try to access the 'item' text nothing
> > happens?
>
> > $(document).ready(function(){
> >         $('#news-feed').each(function(){
> >                 $('this').empty();
> >                         $.get('ultimora.xml',function(data){
> >                                 $('/rss//item').each(function(){
> >                                         var titolo = $('title', 
> > this).text();
> >                                         alert(titolo) NOTHING 
> > HAPPENS!!!!!!!!!!!!!!!!!!
> >                                         })
> >                                 })
>
> >                 })
>
> > });
>
> > And WHY/*??!!*{}AAARGH*/ if i instead use such syntax it works?
> > $(document).ready(function(){
> > $(function() {
> >         $.ajax({
> >                 type: "GET",
> >                 url: "http://www.corriere.it/rss/ultimora.xml";,
> >                 dataType: "xml",
> >                 success: function(xmlData)
> >                 {
> >                         xmlDataSet = xmlData;
> >                         browseXML();
> >                 },
> >                     error: function(){
> >         alert('Errore nel caricamento del file XML');
> >     }
> >         });
> > });
> >         function browseXML(){
> >                 entryLength=$("item",xmlDataSet).length;
> >                 alert(entryLength) // this returns 20, it works!!!
> >         }
>
> > });
>
> > Wich syntax do we have to use?
> > Can you please clarify me one time for all the differences between
> > those two methods?
> > It seems to me that the $.get method works for pretty simple XML file
> > but if your file have other nodes BEFORE item node, it fails.
> > Obviously i'm missimg something (i'm a total newbie) but WHAT?
> > Again, setting up r/c helicopters is easier ;-)
> > Cheers
> > GC

Reply via email to