Nextcloud-App/js/script.js

18 lines
577 B
JavaScript

jQuery(document).ready(() => {
jQuery("#submit").click(() => {
const text = jQuery("#text").val();
console.log("Sending:", text)
fetch(OC.generateUrl('/apps/upschooling/echo'), {
method: 'POST',
body: text,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'requesttoken': oc_requesttoken,
},
}).then(async (res) => {
console.log(res);
jQuery("#response").val(await res.text());
}).catch(console.error)
});
});