0

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);
          }
          });
    }
sunny93
  • 131
  • 1
  • 11
  • 1
    http://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource Same origin policy? – halfzebra Jul 13 '15 at 11:51
  • found my answer thanks – sunny93 Jul 13 '15 at 12:07
  • 1
    Unless `https://outlook.office365.com/api/v1.0/me/calendars` is implemented as a RESTful API, you will not be able to make this call. – Josh Jul 13 '15 at 12:07
  • Yes i am using RESTful API. Is there any other way to do this ? @Josh – sunny93 Jul 13 '15 at 12:39
  • you can use the `cors:true` setting in your AJAX assuming the endpoint allows cross origin access. – Josh Jul 13 '15 at 13:06

1 Answers1

0

In Windows, paste this command in run window

chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security

this will open a new chrome browser which allow access to no 'access-control-allow-origin' header request.

sunny93
  • 131
  • 1
  • 11