Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

141
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda