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)