I am working on a project where I am pulling in a list of events in XML format. The format is as follows for the XML

<allEvents>
  <event>
    <eventName>Name</eventName>
    <price>45</price>
    <showings>
       <showing>
          <eventDate>2009-12-25</eventDate>
       </showing>
    </showings>
  </event>
</allEvents>

What I need to do is display the events on the page in chronological order. Is there an easy way to sort the array by date that is returned when I do an .ajax get with jquery? I can display the data on the page just fine, I am just wondering if there are any tutorials or anything out there that can help me learn how to sort by date using jquery. Thanks.

1 answer

danwellman 5600
0
points

This page has some interesting discussion on sorting data with jQuery

How are you storing the results of the ajax request? Is it in one big array?

Perhaps you could do it so that each <event> block is stored in it's own array, and then all of the arrays are stored in one outer array? Then maybe you could sort the outer array based on the array item of each inner array containing the <eventDate> element?

Answered over 9 years ago by danwellman