Want to add a forum like this one to your store? Install Champ Now

Welcome to Champ's live demo

Did you know that this isn't just a demo?
This is our live pre-sales Q&A and support forum. Take a look around and say "Hello".

  • Forums
  • Support
  • Fetching data through API has been blocked by CORS policy
0

Fetching data through API has been blocked by CORS policy

Sep 18, 2019 - 2:44 AM

https://getchamp.myshopify.com/community/champ/forums/7/topics/10722 Copy
  • Hi all,
    I was using the API feature and succeeded in fetching data with Postman. However, when I tried to use Axios to send HTTP request in, say, champ-below-header.liquid, to fetch data, it returns 404 error stating 'No 'Access-Control-Allow-Origin' header is present on the requested resource'.
    What should I do to fetch the forum/topic/post data in the liquid?

    champ-cors-error.png

    0
  • This issue should now be fixed. I've enabled CORS on the API just now. Let me know if you're running into any issues.

    0

    Need help? Contact me at support@getchamp.net or here. Brand new! Add your own signature at https://getchamp.myshopify.com/community/champ/preference
  • Seems doesn't work either :( , another error came up. I tried to set the request header 'withCredentials' to be 'true' and 'false', but neither worked

    champ-cors-error-credentials.png

    0
  • Let me try and debug this today to see what's happening. I'll update this thread later today.

    0

    Need help? Contact me at support@getchamp.net or here. Brand new! Add your own signature at https://getchamp.myshopify.com/community/champ/preference
  • Update:

    It seems to work for me.

    Here's the code I used:

    $.ajax({
      url: 'https://api.getchamp.net/topics.json',
      type: 'GET',
      beforeSend: function (xhr) {
        xhr.setRequestHeader('X-API-SECRET', '<insert your api secret>');
        xhr.setRequestHeader('X-SHOPIFY-DOMAIN', 'getchamp.myshopify.com');
      },
      success: function (response) { console.log(response) }
    });
    

    I was able to call this from jQuery's own webpage.

    Let me know

    0

    Need help? Contact me at support@getchamp.net or here. Brand new! Add your own signature at https://getchamp.myshopify.com/community/champ/preference
  • What time is Hampton Inn breakfast? Generally, it starts at 6:00 a.m. on weekdays and 7:00 a.m. on weekends. If you’re wondering what time is Hampton Inn breakfast to plan your day, check with your hotel. It's a dependable amenity that starts your day right. https://www.feastandslumber.com/hampton-inn-breakfast-hours/#hampton-inn-breakfast

    0
  • You can find quality online tuition in Hyderabad for every subject. With online tuition in Hyderabad, students have the flexibility to learn from home at their own pace. Our tutors offer personalized guidance and ensure effective learning outcomes, whether it's exam preparation or regular coursework

    This post was edited Aug 10, 2025 01:59PM
    0
  • Outdoor shirts made from quality wool are great at managing body temperature and minimizing skin irritation, even during intense activity. Pairing them with well-fitted socks, protective gaiters, warm beanies, and rugged shoes creates a balanced outfit for both comfort and performance. These pieces also resist wear and tear, making them dependable for repeated adventures. For trusted wool clothing built for the outdoors, visit https://merinoprotect.com/ and explore their certified, ethical range.

    0
  • For a reliable and engaging online gaming experience, visit https://pkr888.app
    to enjoy secure access, smooth gameplay, and a variety of exciting features.

    0
  • For a seamless gaming experience, visit https://lucky33.vip/ to enjoy secure access, smooth gameplay, and a variety of exciting features

    0
Quick reply

How to format posts

Champ uses Markdown for formatting text in posts. Certain markup tags (eg. H1) are forbidden to ensure that pages remain semantically compliant. Other tags are automatically sanitized to ensure all content is secure.

  • Emphasis, aka italics, with *asterisks* or _underscores_.
  • Strong emphasis, aka bold, with **asterisks** or __underscores__.
  • Combined emphasis with **asterisks and _underscores_**.
  • Strikethrough uses two tildes. ~~Scratch this.~~
  • Links are added automatically, but can be formatted like so: [My link](https://mylink.com)
For more information, take a look at the Markdown Cheatsheet.