Search code examples
jqueryxmlpicasa

Jquery XML Parse URL Issue


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>

Solution

  • you can do the cross domain requests (if the server supports it) by

    setting crossDomain:true (added in jquery 1.5)

    and/or

    by setting dataType:'jsonp'

    or else you can create a server side proxy to which you can do the ajax request that proxy will in turn get data from the web service and retyrn the response

    see this answer for creating and getting data back in PHP jQuery.ajax() parsererror