XML : Trouble getting information to display from XML

I am currently having problems trying to get information and images to display from a XML file. The images or the text that is on the XML file is not coming up at all. I'm not sure if the there is something wrong with the code or if I am taking the wrong approach. The first lot of code is what I have tried.

      <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>      <script type="text/javascript">      $(document).ready(function(){          $.ajax({          type:"GET",          url:"data.xml",          dataType: "xml",          success:xmlParser                 });      });      function xmlParser(xml) {              $(xml).find("video").each(function(){              $("#container").append('<div class="video"><img src="thumbnail' + $(this).find("thumbnail").text() +'" width="200" height="225" alt="' + $(this).find("title").text() + '"/><br/><div class="title">' + $(this).find("title").text() +'<br/>' + $(this).find("rating").text() + '</div></div>');              $(".video").fadeIn(1000);          });      }      </script>    

Here is some of the XML file

  <?xml version="1.0" encoding="utf-8"?>  <videos>  <video id="1fb853907b9ca6add9ac">  <url>a.com</url>  <categories>A</categories>  <rating>100</rating>  <title>A</title>  <tags>A;a;AB</tags>  <duration>15</duration>  <thumbnail>http://i1.cdn2a.image.phncdn.com/m=eGcE8daaaa/videos/201011/03/148553/original/12.jpg</thumbnail>    </video>  <video id="d95ebc6a75c00d9926e7">  <url>http://ab.com</url>  <categories>A;B;An</categories>  <rating>100</rating>  <title>Sie spritzt ab</title>  <tags>a;b;as;d</tags>  <duration>65</duration>  <thumbnail>http://i0.cdn2a.image..phncdn.com/m=eGcE8daaaa/videos/201102/17/160998/original/12.jpg</thumbnail>  </video>    </videos>    

I am trying to get all the information to display. The xml file is called data.xml

No comments:

Post a Comment