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

200
Vistas
Get Multiple instances of dataset in document.currentScript, But returning null

I am storing my json files in script tag. All the data are included in mutiple json files. I am getting the data with the help of fetch Api and then converting the response into JSON format. But when i try to access the dataset used in the currentScript, the second instance returns null and throws an error in the browser console as 'cannot read properties of undefined'

Here is the code that i am using

async function getDataset() {
const widgetID = document.currentScript.id;
 const wc = "."+widgetID;
const fetchConfig = await fetch(document.currentScript.dataset.config);
const config = await fetchConfig.json();
const fetchCurrency = await fetch(document.currentScript.dataset.currency);
const curreny = await fetchCurrency.json();
}

HTML:

<script async src="js/widget.js" data-config="js/config.json" data-currency="js/currency.json"></script>
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