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

132
Vistas
Passing Azure Databricks Variable to Html Script

I'm trying to pass a variable from a previous databricks command into this one, but I keep getting a Key Error. Here is the code below...

htmlCode = """ 
  <div id="61534155"></div>

  <script type="module">
    import {Runtime, Inspector} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
    import define from "https://api.observablehq.com/d/7c6f1f9fe48d9231.js?v=3";
    const main = new Runtime().module(define, Inspector.into("#61534155"));
    main.redefine("file", fetch(sampleJson).then(response => response.json()));
   </script> 
   """
displayHTML(htmlCode.format(sampleJson = jsonFile))

jsonFile is the variable from a previous command that I am trying to pass into this HTML code. I keep getting the error "KeyError: 'Runtime, Inspector'" Does anyone have any ideas on resolving it?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

To import import json file in html in javascript you can refer below code.

// pure javascript
let object;
let httpRequest = new XMLHttpRequest(); // asynchronous request
httpRequest.open("GET", "local/path/file.json", true);
httpRequest.send();
httpRequest.addEventListener("readystatechange", function() {
    if (this.readyState === this.DONE) {
        // when the request has completed
        object = JSON.parse(this.response);
    }
});

You can also refer this article by Chuck Connell

about 4 years ago · Juan Pablo Isaza Denunciar
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