【发布时间】:2023-03-02 22:31:01
【问题描述】:
我正在使用 Dribbble API,但我不了解他们关于分页的文档:http://developer.dribbble.com/v1/#pagination
我已尝试研究如何进行设置,但似乎找不到有关如何使用 Link 标头进行设置的信息。这是我现在正在使用的代码,它可以完美地提取最近的 12 张照片,但我对分页感到困惑:
$(document).ready(function() {
var url = 'https://api.dribbble.com/v1/user/shots?per_page=12&access_token=*removed*';
var $content = $('#dribbble');
$.ajax({
type: 'GET',
url: url,
dataType: 'jsonp',
beforeSend: function() {
$content.append('<div class="loading"><img src="./img/ajax-loader.gif" width="66" height="66" alt="Loading"></div>');
},
complete: function() {
$('#loading').remove();
},
success: function(data) {
var template = $('#dribbbleTpl').html();
var html = Mustache.to_html(template, data);
$('#dribbble').html(html).hide().fadeIn(400);
},
fail: function() {
$content.append('<div class="error">Oops! Our Dribbble feed appears to be down.</div>');
}
})
});
【问题讨论】:
标签: api pagination