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();
|
2024-02-17 16:00:01 +01:00
|
|
|
document.getElementById('output').innerHTML = out;
|
2024-02-17 15:53:47 +01:00
|
|
|
}
|