After some research, I found out how to send data to Discord Webhooks. Even though its executing, it wont send the webhook message? Does anyone know why?
<label for="title">Title:</label><br>
<input type="text" id="title"><br>
<label for="desc">Description:</label><br>
<input type="text" id="desc">
<div></div>
<label for="opmes">Message(optional):</label><br>
<input type="text" id="opmes">
<br><br>
<input type="submit" value="Submit" onclick="sendMessage()">
<script>
function sendMessage() {
const request = new XMLHttpRequest();
request.open("POST", "you really wanted my webhook huh?");
request.setRequestHeader('Content-type', 'application/json');
const params = {
username: "My Webhook Name",
avatar_url: "",
content: "The message to send"
}
request.send(JSON.stringify(params));
}
</script>
the errors are:
OPTIONS webhook_url_lol_you_thought
CORS Missing Allow Origin
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at hwebhook_url_lol_you_thought. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 403.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at webhook_url_lol_you_thought. (Reason: CORS request did not succeed). Status code: (null).