I am sending a Discord webhook request using Javascript, but I keep getting the following errror: Access to XMLHttpRequest at
'WEBHOOK URL' from origin 'http://discordfastlist.ml' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I know exactly what this is after googling alot, tried all the solutions I found but nothing seemed to work with Discord webhooks.
The code I am using:
var xhr = new XMLHttpRequest();
xhr.open("POST", "this is the webhook URL, I am not showing this in the code but it is there", true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify({
'content': "test",
'username':'Test Webhook',
}));