hi yanski, thanks for your suggestion. if i do it like that, will the user download the xml file each time the function is called?
On Jan 26, 2008 10:40 AM, Yansky <[EMAIL PROTECTED]> wrote: > > I'm not 100% sure what you're try to do, but here's what I might do: > > UI.dsAnchor = function(UI.item, UI.sortBy){ > > $.get("projects/datascapes.xml", function(xmlData){ > > return $(xmlData).find(UI.sortBy+'[title="' + UI.sortBy + '"]// > item:contains("' + UI.item + '")'); > > }); > > } > > I have no idea if that'll work, but it's what I might try first. :) > > > On Jan 26, 2:25 am, "Alexandre Plennevaux" <[EMAIL PROTECTED]> > wrote: > > Hello again, > > > > gosh this should be so easy yet i can't make it work. Here is what i'm > trying to do: i have a data structure stored as an xml file. > > > > I need to load this structure once at the start of the application. > > I need a function to search through this data structure and return the > corresponding value. > > > > So far i fail miserably because i don't quite get the > synchronous/asynchronous side of jlife. > > > > Here is the code i came up with (you might have seen it in my other > post, i'm fighting against it since this morning): > > > > function findProjectAnchor(projectName, scape){ > > var thisDS = datascapeAnchorsXml.find('scape[title="' + scape + > '"]'); > > var myVal = $("item:contains('" + project + "')", > thisDS).attr('rel'); > > return myVal; > > > > } > > > > jQuery(function($){ > > > > $.get("projects/datascapes.xml", {}, function(xmlData, strStatus){ > > var datascapeAnchorsXml = $(xmlData); > > }); > > > > /// this is how i call it: > > UI.dsAnchor = findProjectAnchor(UI.item, UI.sortBy); > > > > ); > > > > what's wrong with it ? > > > > thank you for your time and assistance, > > > > Alexandre Plennevaux > -- Alexandre Plennevaux LAb[au] http://www.lab-au.com