【发布时间】:2013-01-05 06:27:53
【问题描述】:
我将 github api 用于小型 Web 应用程序,有时我需要为 the pagination 获取 link header。
最终目标是获取每个存储库的提交总数,我发现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分别是用户名和他的repo名
这是一个 Github 页面,所以我只能使用 JavaScript。
【问题讨论】:
标签: javascript jquery http-headers github-api