Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda