the get is asynchronous, meaning that datascape.getAllAnchors is returned (nothing/undefined) before the ajaxall (get) returns success.
On Jan 21, 3:41 pm, "Alexandre Plennevaux" <[EMAIL PROTECTED]> wrote: > Hello, > > i'm loading a bit of xml and i'm trying to use the loaded data, but i 'm > unsuccessful traversing it so far. Can you tell me what i'm doing wrong? > > here is the loading code: > > datascape.getAllAnchors = function(){ > $.get("projects/datascapes.xml",function(data){ > return $(data); > }); > > } > > then further down, i need to retrieve an item's parent col element "title" > attribute. > > jQuery(function($){ > > ... > > var thisDS = $('scape[title="'+UI.section+'"]', datascape.anchors); > var dsAnchorVar = $('item[title="' + $proj + > '"]',thisDS).parents('col').attr('title'); > $.log("anchor "+$proj+"= "+ dsAnchorVar ); > > }); > > the console keeps on showing dsAnchorVar as "undefined" > > the xml file: > > <?xml version="1.0" encoding="UTF-8"?> > <datascapes> > <scape title="title"> > <col title="E"> > <item title="electric_courtship_songs" /> > </col> > <col title="L"> > <item title="liquidspace" /> > <item title="liquidspace01" /> > <item title="liquidspace02" /> > <item title="liquidspace03" /> > </col> > <col title="S"> > <item title="space-navigable-music" /> > </col> > </scape> > <scape title="time"> > <col title="2004"> > <item title="electric_courtship_songs" /> > </col> > <col title="2003"> > <item title="liquidspace" /> > <item title="liquidspace01" /> > </col> > > </scape> > </datascapes> > > Thanks for any help, > > Alexandre