title: Calling Outlook API to Add event to outlook calendar using ajax call
body: <p>I need to Add an event from my database to outlook calendar for which I have been trying to make an ajax call to the outlook auth API first which looks like this</p>
  
  <pre><code>$scope.authorizeOutlook = function () {
  
      let redirect = 'http://localhost:51419';
      let clientId = 'xxx';
  
      var authData = 'client_id=' + clientId + '&amp;response_type=code&amp;redirect_uri=' + redirect + '&amp;response_mode=query&amp;scope=https%3A%2F%2Fgraph.microsoft.com%2Fcalendars.readwrite%20&amp;state=12345';
      debugger
      $.ajax({
          url: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
          type: 'POST',
          host: 'https://login.microsoftonline.com',
          contentType: "application/x-www-form-urlencoded",
          contentLength: "600",
          data: authData,
          success: function (response) {
              debugger;
              alert(response.status);
              //alert("success");
          },
          error: function (response) {
              alert(response.status);
              //alert("fail");
          }
      });
  }
  </code></pre>
  
  <p>But I am getting response status as 0. What does that mean? Where am I doing it wrong?</p>