这个脚本有什么问题? 我试图从谷歌使用ggogle apis获取javascript的任务列表。 这是代码:
<html>
<head>
<title>Google auth</title>
<script src="https://apis.google.com/js/client.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.js"></script>
<script>
function auth() {
var config = {
'client_id': '198071236552-5ou4utkvmknkcj48prfah7a4mpm86f5v.apps.googleusercontent.com',
'scope': 'https://www.googleapis.com/auth/tasks https://www.googleapis.com/auth/tasks.readonly'
};
gapi.auth.authorize(config, function() {
makeTasksApiCall();
});
}
function makeTasksApiCall() {
gapi.client.load('tasks', 'v1').then(function () {
var request = gapi.tasks.tasklists.list();
request.execute(function (resp) {
for (var i = 0; i < resp.items.length; i++) {
var li = document.createElement('li');
li.appendChild(document.createTextNode(resp.items[i].summary));
document.getElementById('tasks').appendChild(li);
}
});
});
}
</script>
</head>
<body>
<button onclick="auth();">GET CONTACTS FEED</button>
<div id="tasks">
</div>
</body>
</html>
错误: gapi.tasks未定义
谢谢