I need to get json from a third-party source using a javascript, but when I do this I get a header error.
I did this using fetch() method:
fetch('https://orderarchive.okd.artpix3d.com/api/v1/shopify/shipping-methods', { mode: 'cors' });
And this option didn’t help me - mode: ‘cors’. I get this error:
has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
Also, I made this solution:
$.getJSON('https://orderarchive.okd.artpix3d.com/api/v1/shopify/shipping-methods', function(data) {
// Code
});
And also did a solution using XMLHttpRequest and etc. I have tried many methods and ways to get the json blacken javascript I want, but I always get the error I wrote above.
Please help me to get json through javascript, in shopify, or tell me how to do it.
I contacted the technical support shopify, but tech support could not give a specific answer to this question, and advised to write my question here.
Thank you.