Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery XML Parse URL Issue

Tags:

jquery

xml

picasa

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>
like image 669
Goldy234 Avatar asked Feb 22 '26 21:02

Goldy234


1 Answers

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>
like image 133
Goldy234 Avatar answered Feb 25 '26 12:02

Goldy234