Después de investigar un poco, descubrí cómo enviar datos a Discord Webhooks. Aunque se está ejecutando, ¿no enviará el mensaje del webhook? ¿Alguien sabe por qué?
<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>los errores son:
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).