Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
Where to put my code "Access-Control-Allow-Origin"?

I need to retrieve data from an api but the data is only available in XML. I was told to retrieve the data to display it in HTML via this topic: How to retrieve values from xml file and display in html webpage?

Until I thought I was right, I changed the code with the info I needed and got the famous error in the Google Chrome console: (index):30 Access to XMLHttpRequest at 'xxx' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

So in my index.html file I added this PHP code at the beginning : <?php header('Access-Control-Allow-Origin : *'); ?> (I use the * for the tests only, to publish my code I will set the exact URL).

My page still shows this error, so I'm wondering if it's really on my code that I should put this, or on the recipient's server?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!