Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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.
Thanks for the answer.
I just want to get json from a third-party source via javascript. Is this possible? If not, what could be the solution?
You should be able to, it might be a Cross Origin Resource Sharing (CORS) issue... Do you have that resource blocked for External IPS?
I reckon you'd get an answer in this forum: https://stackoverflow.com/ if none of us on Shopify manages to help!
Hi Max! I was wondering if they helped over in stack overflow?
Hello. Yes, I asked that question on stackoverflow. And I was told that this problem cannot be solved without reference to the server side. I need to write my own application to do this. This is so silly!
That's so frustrating! Shame we didn't find a solution for it. 😞
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025