MojoFrontend/scripts/console.js
2022-05-03 04:19:25 -07:00

22 lines
540 B
JavaScript

async function sendCommand(payload){
let key = new window.URLSearchParams(window.location.search).get("k");
let url = '/mojoplus/api';
let data = JSON.stringify({ "k": key, "request": "invoke", "payload": payload });
let response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: data,
})
let json = await response.json();
return json
}
function switchPage(page) {
const iframe = document.getElementById("content");
iframe.src = `pages/${page}.html`;
}