我正在使用github API进行小型网络应用程序,并且在某些时候我需要获得link header的the pagination。Github API使用ajax获取链接标题
最终的目标是让每个仓库的更新总数,我发现python script,并试图将其改编为JavaScript。
getData = $.getJSON('https://api.github.com/repos/'+user+'/'+repo+'/commits?callback=?', function (commits){
console.log(getData.getResponseHeader('link'))
// will return null
console.log(getData.getAllResponseHeaders('link'))
// will return an empty string
console.log(commits)
// will successfuly return my json
});
user
和repo
分别是用户的名字和他的名字回购
这是一个为Github的页面,所以我只能使用JavaScript。
这是完美的,谢谢 –