我正在使用 jQuery 对flickr API进行 ajax 调用。
到目前为止,我已经成功调用了公共照片API 并显示了结果。这是我使用的 jQuery:
getPics = function(){
    $.ajax({
        url: 'http://api.flickr.com/services/feeds/photos_public.gne?format=json&jsoncallback=callbackForImages',
        dataType: 'jsonp'
    });
}
callbackForImages = function(data){
    clearResults();
    $.each(data.items, function(i, item) {
        $("<img/>").attr("src", item.media.m).appendTo("#results");
    });
}
但是,当我尝试使用论坛 API时,我不确定如何格式化回调函数。
这是我到目前为止所拥有的。
getTopics = function(){
    $.ajax({
        url: 'http://api.flickr.com/services/feeds/forums.gne?format=json&jsoncallback=callbackForTopics',
        dataType: 'jsonp'
    });
}
callbackForTopics = function(data){
    clearResults();
    //this is the bit that's broken
    $.each(data.items, function()) {
        $("title").value.appendTo("#results");
    }
}
clearResults = function(){
    $("#results").html('<div id="results"></div>');
}
任何帮助理解如何使用返回的 JSONP 将不胜感激。