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

149
Views
¿Por qué recibo el error "No hay encabezado 'Access-Control-Allow-Origin' presente en el recurso solicitado" en mi sitio?

Estaba jugando con las API para familiarizarme con ellas, y estoy tratando de mostrar una lista de nombres de objetos de una API. Pero cuando abro mi sitio web, no se muestra nada y aparece un error de CORS. Aquí está mi código:

 const url = 'https://api.wynncraft.com/v2/ingredient/list'; const mainDiv = document.getElementById('container'); fetch(url) .then((resp) => resp.json()) .then(function(data) { let ingredients = data.results; return ingredients.map(function(ingredient) { let li = createNode('li'); let span = createNode('span'); span.innerHTML = `${ingredient.name}`; append(li, span); append(ul, li); }) }) .catch(function(error) { console.log(error); }); function createNode(element) { return document.createElement(element); } function append(parent, el) { return parent.appendChild(el); }

Y el HTML asociado:

 <!DOCTYPE html> <html> <head> <title>Wynncraft API Test</title> </head> <body> <div id="container"></div> <script src="script.js"></script> </body> </html>

¡Cualquier ayuda es muy apreciada!

Código de error

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!