title: How to resolve Ajax error No 'Access-Control-Allow-Origin' header is present on the requested resource'
body: <p>I am trying to get token from drchrono.com. But I get following error. Can somebody please help me how to solve this?</p>
  
  <p>Error</p>
  
  <blockquote>
    <p>Access to XMLHttpRequest at '<a href="https://drchrono.com/o/token/" rel="nofollow noreferrer">https://drchrono.com/o/token/</a>' from
    origin 'null' has been blocked by CORS policy: No
    'Access-Control-Allow-Origin' header is present on the requested
    resource.</p>
  </blockquote>
  
  <p>Method</p>
  
  <pre><code>function getToken() {
      var authData = {};
      authData.code = $("#txtCode").val();
      authData.grant_type = "authorization_code";
      authData.redirect_uri = "https://test.com/WebForm1.aspx";
      authData.client_id = "asdfasdfadfassdfasddfdsaf";
      authData.client_secret = "asdfasdfasdfasfasfasdfsafsadfsadf";
  
      var jsonAuthData = window.JSON.stringify(authData);
      var authDataUri = "https://drchrono.com/o/token/";
      $.ajax({
          type: "POST",
          contentType: "application/json; charset=utf-8",
          datatype: "json",
          url: authDataUri,
          data: jsonAuthData,
          async: true,
          crossDomain: true,
          headers: {
              'Access-Control-Allow-Origin': '*'
              //'Access-Control-Allow-Origin': 'https://test.com/WebForm1.aspx'
          },
          beforeSend: function (XMLHttpRequest) {
          },
          success: function (data, textStatus, XmlHttpRequest) {
              console.log(data);
          },
          error: function (XMLHttpRequest, textStatus, errorThrown) {
              console.log(XMLHttpRequest);
              console.log(textStatus);
              console.log(errorThrown);
          }
      });
  }
  </code></pre>