this returned a myVal of 2007:

 $(document).ready(function(){
                $.ajax({
                type:   "GET",
                url:    "jquery_test.xml", //your xml
                data:   "",
                dataType:       "xml",
                success: function(data,textStatus) {
                         findAnchor("test-release","time",data);
                },
                error: function(msg) {
                      //call function to pass friendly message back to thread 
and
end "fetching"
                      //opts.onFail();
                }
         });

                function findAnchor(projectName,scape, xml){
                var myscape = $("scape[title='" + scape + "']", xml);
                var myItem = $('item[title="' + projectName + '"]', myscape);
                var myCol  = $(myItem).parent();
                myVal = $(myCol).attr('title');
                alert("dsanchor for " + projectName + "in scape:UI.sortBy=" +
myVal);
                return myVal;
            }
    });




On Jan 21, 4:49 pm, "Alexandre Plennevaux" <[EMAIL PROTECTED]>
wrote:
> Hello again,
>
> i'm banging my head on this issue:
>
> I'm using a function to search through a small bit xml. It works more or less 
> except that the returned value is not correct.
>
> Here is my function:
>
>     function findAnchor(projectName,scape, xml){
>         var myscape = $("scape[title='" + scape + "']", xml.responseText);
>         var myItem = $('item[title="' + projectName + '"]', myscape);
>                 var myCol  = $(myItem).parent();
>                 myVal = $(myCol).attr('title');
>         $.log("dsanchor for " + projectName + " in scape:" + UI.sortBy + "=" 
> + myVal);
>         return myVal;
>     }
>
>     The xml file is herebelow. Now, if i try :  var dsAnchorVar = 
> findAnchor('test-release','time', xml);
>
>     it returns "time", whereas it should return "2007".  Can you tell me why 
> ? It seems to me the .parent(); selector does not function...
>
> <?xml version="1.0" encoding="UTF-8"?>
> <datascapes>
>         <scape title="title">
>                 <col title="L">
>                         <item title="liquidspace" />
>                         <item title="liquidspace01" />
>                 </col>
>                 <col title="S">
>                         <item title="space-navigable-music" />
>                 </col>
>                 <col title="T">
>                         <item title="test-release" />
>                         <item title="touch" />
>
>                 </col>
>         </scape>
>         <scape title="time">
>                 <col title="2004">
>                         <item title="electric_courtship_songs" />
>                 </col>
>                 <col title="2004">
>                         <item title="liquidspace02" />
>                 </col>
>                 <col title="2007">
>                         <item title="liquidspace03" />
>                 </col>
>                 <col title="2000">
>                         <item title="space-navigable-music" />
>                 </col>
>                 <col title="2007">
>                         <item title="test-release" />
>                 </col>
>                 <col title="2006">
>                         <item title="touch" />
>                 </col>
>         </scape>
> </datascapes>
>
> Alexandre

Reply via email to