mirror of
https://github.com/SpikeHD/MojoFrontend.git
synced 2024-11-26 10:21:48 +00:00
22 lines
540 B
JavaScript
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`;
|
|
} |