title: Getting error origin 'null' has been blocked by CORS policy?
body: <p>I am calling AWS API gateway using the following code.</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
      &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot;&gt;&lt;/script&gt;
      &lt;script&gt;
          $(document).ready(function(){
              $(&quot;#btn&quot;).click(function(){
                  var finalJson = {
                    &quot;entityType&quot;: &quot;abc&quot;,
                    &quot;entityId&quot;: &quot;123&quot;
                  };
                  $.ajax({
                      type : &quot;POST&quot;,
                      contentType : &quot;application/json&quot;,
                      xApiKey : &quot;api-key&quot;
                      url : &quot;api-gateway-url&quot;,
                      data : JSON.stringify(finalJson),
                      dataType : 'json',
                      timeout : 100000,
                      success : function(data){
                          alert('Congrats! You got the response');
                          console.log(data);
                      },
                      error : function(data){
                          alert('Error');
                          console.log(data);
                      }
                  });
              });
          });
      &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h2&gt;API Gateway call&lt;/h2&gt;
          &lt;button type=&quot;button&quot; id=&quot;btn&quot;&gt;Request data&lt;/button&gt;
          &lt;p id=&quot;demo&quot;&gt;&lt;/p&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>API Gateway has a POST method and it is linked with the Lambda function.
  I have already enabled CORS in API gatewaye.
  After clicking on the Request data button, showing the following error.</p>
  <pre><code>Access to XMLHttpRequest at 'API Gateway URL' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  <p>Please help, Thanks :)</p>