I have tried different solutions from google but none worked for me. Here is a piece of code that I am calling in setInterval method in document.ready() function.
function getCalendarsO365(){
if(token == undefined){
return;
}
var myurl = 'https://outlook.office365.com/api/v1.0/me/calendars';
$.ajax({
dataType: "jsonp",
jsonp: "callback",
jsonpCallback: "jsonpcallback",
headers: { 'Authorization': "Bearer " + token},
url: myurl ,
success: function(data){
parseCalendar(data);
},
error: function(data){
alert(data);
}
});
}