18 lines
477 B
JavaScript
18 lines
477 B
JavaScript
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').innerHTML = out;
|
|
}
|