This repository has been archived on 2025-08-21. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
hohoho/api/index.html
2020-12-07 15:57:57 +01:00

33 lines
No EOL
1 KiB
HTML

<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title>test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<textarea id="testa"></textarea>
<textarea id="func"></textarea>
<textarea id="instr"></textarea>
<script>
function doReq() {
const instr = document.getElementById("instr").value.replace(/\+/g, "%2B"); //necessary for encoding
const options = {
method: 'POST',
body: `func=${document.getElementById("func").value}&instr=${instr}`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}
console.log(options.body);
fetch('https://dev.jakobsenkl.pw/hohoho/api.php', options)
.then(res => res.text())
.then(res => (document.getElementById("testa").value = res))
.catch(err => console.error(err));
}
</script>
</body>
</html>