views:

91

answers:

1

I'm using the following jQuery code to try and access the delicious api, but it's not working. If I go directly to the api url in the browser it returns the xml as expected, so the url is correct.

Anyone got any ideas what's up? Could be that it's https, but teh jQuery documentation doesn't explicitly forbid this.

$(document).ready(function(){
    $.ajax({
        type: 'GET',
        dataType: 'xml',
        url:"https://api.del.icio.us/v1/posts/dates",
        success: function(response) {
            console.log(response);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
            console.log(textStatus);
            console.log(errorThrown);
        }
    });
});

edit:

I get a "data is null" error, which still happens if I set data: '', and on first attempt to access the page in the browser I'm prompted for username and password, which seems to be stored as if I include a tag with href="https://api.del.icio.us/v1/posts/dates" in the head it downloads the file ok

A: 

As Mr. Sanchez points out, you can't issue XMLHttpRequests to that API from a page hosted in your domain.

Maybe they've got a JSONP version of the API.

[edit] read this: http://www.elctech.com/snippets/get-delicious-api-url-tags-bookmarks-via-jquery

Pointy
delicious have been pretty lazy as you can get the feeds - up to 100 latest items - via json, but not the full API. I can't imnagine it woudl be more than a few days (hours? minutes?) work for them to create json templates in addition to the xml.Thanks for the answer though
wheresrhys