Linked Questions

Popular Questions

I have been trying to work this xml data into divs I have managed it to a point but it will only show the first value not sure why and any help would be greatly aprrecated

I have followed a few tutorials to extract data from an XML file but can't get it to show for then one value

<!DOCTYPE html>
<html>
    <head>
        <title>Movies</title>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
        <script type="text/javascript">
        $.ajax({
        type: "GET",
        url: "movies.xml",
        dataType: "xml",
        success: function(data) {
            $(data).find('dates').each(function() {
                var movies = $(this).find('film').attr('name');
                var time = $(this).find('session').attr('time');

             $('.container').append( movies + ' <br> ' + time );

        })
    },
        error: function() {
            $('.container').text('Failed to get feed');
        }
    });

        </script>           

    </head>
    <body>

        <div class="container">

        </div>


    </body>
</html>         


<?xml version="1.0" ?>
<!-- Version 8.216 (Build 8216) -->
<!-- INTERNET FTP Sessions (Extended - Sort By Date) -->
<!-- Sessions for 3 February 2019-->

<ROOT guid="{E8AFA1E2-B92A-4590-8049-50EE083899B0}" versionNo="8216" releaseNo="45577" dateCreated="3 February 2019" timeCreated="12:16 pm" dateFrom="3 February 2019" dateTo="3 February 2019" >
<site siteNo="9200" siteName="Starlight Cinema Centre" timeFormat="h:mm am/pm" >
<movies>
<cinemas>
    <cinema cinemaNo="1" name="CINEMA 1" cinemaID="1" cinemaTypeNo="0" />
    <cinema cinemaNo="2" name="CINEMA 2" cinemaID="2" cinemaTypeNo="0" />
    <cinema cinemaNo="3" name="CINEMA 3" cinemaID="3" cinemaTypeNo="0" />
    <cinema cinemaNo="4" name="CINEMA 4" cinemaID="4" cinemaTypeNo="0" />
    <cinema cinemaNo="5" name="CINEMA 5" cinemaID="5" cinemaTypeNo="0" />
    <cinema cinemaNo="6" name="The Lounge" cinemaID="6" cinemaTypeNo="1" />
</cinemas>
<dates>
    <date  asInteger="20190203" asText="3 February 2019">
    <film filmNo="3326" name="AQUAMAN (LD)" duration="2 hrs 40 mins" rating="M" >
    <cinemaType cinemaTypeNo="0" name="Cinema" >
        <sessions  filmNo="3326">
        <session time="1:15 pm" cinemaNo="5" />
                <session time="6:40 pm" cinemaNo="5" />
        </sessions>
    </cinemaType>
    </film>
    <film filmNo="3337" name="DRAGON BALL SUPER: BROLY" duration="2 hrs" rating="PG" >
    <cinemaType cinemaTypeNo="0" name="Cinema" >
        <sessions  filmNo="3337">
        <session time="1:40 pm" cinemaNo="1" />
        <session time="6:40 pm" cinemaNo="5" />
        </sessions>
    </cinemaType>
    </film>
    <film filmNo="3334" name="GLASS (LD)" duration="2 hrs 25 mins" rating="M" >
    <cinemaType cinemaTypeNo="0" name="Cinema" >
        <sessions  filmNo="3334">
        <session time="11:00 am" cinemaNo="1" />
        <session time="6:20 pm" cinemaNo="3" />
        </sessions>
    </cinemaType>
    </film>
    </date>
</dates>
</movies>
</site>
</ROOT>
<!-- End File -->

Need it to show all movies and times but it is only showing one like it only showing AQUAMAN (LD) 1:15 pm

Thanks for any help

Related Questions