I'm using API JavaScript Client with Calendar, but I have an error!
Perhaps somebody knows what is happening.
Thanks a lot.
This is the error:
Uncaught TypeError: Cannot read property 'events' of undefinedAnd this is my code:
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
var apiKey = 'xxxxxxx';
function makeRequest(){
console.log('Google Calendar API loaded.');
gapi.client.calendar.events.list({'calendarId' : 'xxxxxxxx'}).then(function(resp){ //This line throws the error console.log(resp.result.item);
}, function(reason){
console.log('Error '+reason.result.error.message);
});
}
function init(){
gapi.client.setApiKey(apiKey);
gapi.client.load('Calendar API', 'v3').then(
makeRequest()
);
}
</script>
<script type="text/javascript" src="
https://apis.google.com/js/client.js?onload=init"></script>
</head>
<body>
</body>
</html>