Problems with Shopify API

I was able to recently get Shopify to generate an API to fetch the data from orders, customers, etc... With Insomnia or Postman it works normally, but trying to use the same API with ajax it doesn't work.

$.ajax({
    type: 'GET',
    url: 'https://X:[email protected]/admin/api/2020-07/orders.json?status=any',
    headers: {
        "Access-Control-Allow-Origin": "*"
    },
    success: (result) => {
        console.log(result)
    }
})

This and the ajax Code

Access to XMLHttpRequest at 'https://X:[email protected]/admin/api/2020-07/orders.json?status=any' from origin 'http://X.X.X.7' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

If anyone can help me! After the comment here in the post I edited inserting the headers but it still did not work the error now is:

Access to XMLHttpRequest at 'https://X:[email protected]/admin/api/2020-07/orders.json?status=any' 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.
Failed to load resource: net::ERR_FAILED

Thank you

Author: Marques Souza, 2020-07-13