I'm posting form data. I want to not trigger CORS when I send the HTTP request.
I'm using jquery's $.ajax call thus:
$.ajax({
method: "POST,
url: url,
data: e.serialize(),
cache: !1,
dataType: "json",
contentType: "application/json; charset=utf-8",
error: function(e) {
alert("Could not connect to the registration server. Please try again later."), console.log(e)
},
success: function(e) {
console.log("success")
}
})
Presently when this is called, my browser returns the message:
"Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource"
This seems self-explanatory: 'Access-Control-Allow-Origin' isn't configured as an http header for that resource. CORS is not enabled for the resource.
That's fine. And means I can send the request without bothering about CORS, right? The users browser is trying to protect the user, where no protection is really neccessary.
The thing is, I'm stuck with trying to send the request without triggering CORS. How do I configure my request to prevent CORS from kicking in?
Thanks.