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

207
Visualizações
Repl.it Failed to load module script: Expected a JavaScript module script

import myJson from './usage.json';
function pyRun(file, input) {
    console.log('b');
    $.ajax({
        type: "POST",
        url: `${file}.py`,
        data: { param: input },
    }).done(() => {
            console.log('a');
            console.log(myJson.test);
        });
}

function clicked(){
    console.log('c');
    pyRun('test', 'input');
}

document.getElementById("sendBtn").addEventListener("click", clicked());
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Open Aternos Server!</title>
</head>
<body>
    <script
          src="https://code.jquery.com/jquery-3.4.1.min.js"
          integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
          crossorigin="anonymous"></script>
    <input type="text" id="name" placeholder="User name">
    <input type="text" id="pass" placeholder="Password">
  <button id="sendBtn">Start</button>
  <script type="module" src="script.js"></script>
</body>
</html>

this is my html and js code and here also json:

{
"name": "",
"pass": "",
"info": "",
"succes": "",
"test": ""
}

and also python:

print("runing nice!")
uFile = open("usage.json", "w")
json_object = json.load(uFile)
json_object["test"] = "test"
json.dump(json_object, uFile)
uFile.close()

and when I run it on repl.it gives the error: "Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/json". Strict MIME type checking is enforced for module scripts per HTML spec." I don't know why that's happening I search it on web but in codes they are using server hosts I am not using an host and because of this I don't know why this happens and also if I have any wrong thing in other parts of code please also say them because I can't run code with this error so I can't see the result thanks already(I use console.log('a') or console.log('c') like things to understand what part is wrong but console was empty there was only error I mention above)

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