[jQuery] Using the Accordion with Ajax generated content

[jQuery] Using the Accordion with Ajax generated content


I am having troubles getting ajax content to work in an accordion. It
shows everything fully listed. Not sure what might be wrong... Here is
my code:
            $('#EventListings').accordion({
             header: '.EventsInListHeader',
             active: false,
             alwaysOpen: false,
             autoHeight: false
            });
            // This is for the Events section
            $.ajax({
                    type: "GET", url: "xml/ConventionEvents.xml", dataType: "xml",
                    success: function(xml) {
                        $(xml).find('event').each(function(){
                            var EventName = $(this).find('name').text();
                            var EventLoc = $(this).find('location').text();
                            var EventDate = $(this).find('dates').text();
                            var EventLogo = $(this).find('logo').text();
                            var EventDesc = $(this).find('desc').text();
                            var EventRegLink = $(this).find('register').text();
                            var EventMoreLink = $
(this).find('LearnMore').text();
                            var EventVidLink = $(this).find('video').text();
                            var EventVendorLink = $(this).find('vendorApp').text();
                            $('<div class="EventsInListHeader">'+EventName+' '+EventLoc+',
'+EventDate+'</div><div class="EventsInList" style="background-
image:url(/'+EventLogo+');"><span>'+EventDesc+'</span><a href="/
events/'+EventRegLink+'" rel="shadowbox;width=776;height=600"
class="EventsInListButtons">Register</a><a href="/
events/'+EventMoreLink+'?<%=SessionParam%>"
class="EventsInListButtons">Learn More</
a>').appendTo('#EventListings');
                        });
                    }
            });