sandy/static/script/executor.js

18 lines
473 B
JavaScript
Raw Normal View History

2024-02-17 15:53:47 +01:00
async function executeCode(code, lang) {
const data = await fetch(
window.location.protocol + '//' + window.location.hostname + '/exec',
{
method: 'POST',
body: JSON.stringify({
code,
lang
}),
headers: {
'Content-Type': 'application/json'
}
}
)
const out = await data.json();
document.getElementById('output').value = out;
}