Reputation: 31
so im trying to do this:
if (userPass == "0" && emailPass == "0" && dniPass == "0"){
$.ajax({
method: "POST",
contentType: "text/plain",
dataType : "text",
url: "..php/newUser.php",
data: { uid: uId, Plan : plan, Name : name, Dni : dni, Email : email, User : user, Pass : pass},
success: doneReg
});
}
}
But i keep getting "Response for preflight is invalid (redirect)" although im making the request to my own server. The browser keeps using the OPTIONS method.
I looked in google and everywhere they said it was a CORS problem that was solved by indicating that the content-type was text / plain but as you can see in the code I'm trying to do that but it does not work. Does anyone know how to fix it?
doneReg is the callback to get the data.
newUser.php respones is just a plain text.
The data is just Strings.
Upvotes: 1
Views: 71
Reputation: 23685
background: your backend must not answer with redirect to OPTIONS
request.
Possible root cause:
Upvotes: 1