jQuery selectors take an optional 2nd parameter to provide a search
context (object to search through). Pretty minor but it reduces the
code nicely... you can get rid of the 3 find()'s.

  var time = $('time',this).text();
  var dj = $('dj',this).text();
  var showname = $('showname',this).text();

Docs about it are here:
http://docs.jquery.com/Core/jQuery#expressioncontext

-Wick
http://www.CarComplaints.com


On May 17, 8:43 pm, "comslash.com" <comsl...@gmail.com> wrote:
> $(function(){
>
>                         $.ajax({
>                                 type: "GET",
>                                 url: "test.xml",
>                                 dataType: "xml",
>                                 success: function(data){
>                                  $('day[name=Monday]>show', 
> data).each(function(){
>                                                         time     = 
> $(this).find('time').text();
>                                                         dj               = 
> $(this).find('dj').text();
>                                                         showname 
> =$(this).find('showname').text();
>
>                                                         $('body').append(time 
> + '<br />' + dj + '<br />' + showname +
> '<br /><br />');
>                                          });
>                                 }
>                         });
>
>                 });

Reply via email to