kinda works now huh
This commit is contained in:
1 parent
81ead9bb32
commit
b0e4a8c496
2 files changed
+113
-53
No files matched your search
+61
-17
@@ -1,19 +1,63 @@
|
||||
<form action="/endp" method="post">
|
||||
<style>
|
||||
@scope {
|
||||
:not(style) {
|
||||
display: block;
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
p {
|
||||
font-size: larger;
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>lđa testing</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form action="/endp" method="post" id="only_form">
|
||||
<style>
|
||||
@scope {
|
||||
*:not(style, script) {
|
||||
display: block;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: larger;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<label for="oneid">thing:<input type="text" name="one" id="oneid" /></label>
|
||||
<label for="twoid">other:<textarea rows="7" cols="40" name="two" id="twoid"></textarea>
|
||||
</label>
|
||||
<label for="threeid">number:<input type="number" name="three" id="threeid" /></label>
|
||||
<label for="fourid">probably will check with js idfk<input type="number" name="four" id="fourid" /></label>
|
||||
<input type="submit" value="Sumit ur font assfuck" />
|
||||
</form>
|
||||
</style>
|
||||
<label for="oneid">url (anything after the first /):<input type="text" name="one" id="oneid"
|
||||
placeholder="url" /></label>
|
||||
<label for="twoid">content (as html cuz mime my ass):<textarea rows="7" cols="40" name="two" id="twoid"
|
||||
placeholder="content"></textarea>
|
||||
</label>
|
||||
<label for="threeid">response code if path visited. Default 200<input type="number" name="three" id="threeid"
|
||||
placeholder="http res code" min="0" /></label>
|
||||
<label for="fourid">expiration time for anything (todo idk how to do )<input type="number" name="four"
|
||||
id="fourid" placeholder="expiration in days" min="0" /></label>
|
||||
<p>if bugs tell me how to solve cuz im bad</p>
|
||||
<input type="submit" value="Sumit rn" />
|
||||
<script>
|
||||
const form = document.getElementById("only_form");
|
||||
// const what = form.querySelector("input[type=submit]");
|
||||
console.log(form);
|
||||
form.addEventListener("submit", (e) => {
|
||||
// somewhere there has been code
|
||||
e.preventDefault();
|
||||
const data = new FormData(form);
|
||||
const jsData = Object.fromEntries(data);
|
||||
Object.entries(jsData).forEach(
|
||||
([k, v]) => (jsData[k] = v ? v : undefined)
|
||||
); // important here as we are dealing with Strings true/false kinda works how it is.
|
||||
const jsonified_data = JSON.stringify(jsData);
|
||||
const jsonified_custom_data = `{"from":"ldlda","data":${jsonified_data}}`; // haxxor
|
||||
const xhr = new XMLHttpRequest(); // this is going to be used. a lot.
|
||||
xhr.open("POST", form.getAttribute("action"));
|
||||
xhr.setRequestHeader("Content-type", "application/json");
|
||||
xhr.send(jsonified_custom_data);
|
||||
xhr.addEventListener(
|
||||
"load",
|
||||
(_) => (document.getElementById("what").innerText = xhr.response)
|
||||
);
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
</form>
|
||||
<div id="what"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user