Jquery XML Parse URL Issue

Goldy234 picture Goldy234 · Jul 11, 2011 · Viewed 10.2k times · Source

I have been trying to pull in the names of the albums from picasa using the jquery xml parser. However when I use the "https://picasaweb.google.com" link the function doesn't work. Any clues as to what I am doing wrong?

 <script>
      $(document).ready(function()
    {
      $.ajax({
        type: "GET",
        url: "https://picasaweb.google.com/data/feed/api/user/userID?kind=album&access=visible",
        dataType: "xml",
        success: parseXml
      });
    });

    function parseXml(xml)
    {
      $(xml).find('entry').each(function()
      {
       $("#output").append($(this).find('title').text() + "<br />");
      });
    }
    </script>


    <div id="output"></div>

Answer

Goldy234 picture Goldy234 · Jul 12, 2011

For those interested below is the corrected code

<script>
  $(document).ready(function()
{
  $.ajax({
    type: 'GET',
    url: 'https://picasaweb.google.com/data/feed/api/user/userID?kind=album&access=visible',
    crossDomain: true,
    dataType: 'jsonp',
    success: parseXml
  });
});

function parseXml(xml)
{
  $(xml).find('entry').each(function()
  {
   $("#output").append($(this).find('title').text() + "<br />");
  });
}
</script>