I have an ARC set up by the client and everything seems to be working OK in ARC and the back-end, but I cannot see what I'm doing wrong in jQuery
Here's the ARC test
Here's my jQuery code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script
src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<script>
let urlBase = 'http://54.210.29.209';
let urlEnterEmail = '/api/v1/users/checkEmail';
$(document).ready(function() {
$.ajax(
{
method: "POST",
crossDomain: true,
url: urlBase + urlEnterEmail,
xhrFields: {withCredentials: true},
headers: {
"Access-Control-Request-Headers": "x-requested-with",
"Content-Type": "application/json",
"Platform": "web",
"Build": 2
},
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: {"email": "john@doe.com"}
}
)
.done(function (response) {
console.log('done!');
console.log(response);
})
.fail(function (xhr, status) {
console.log('fail!!!');
//console.log(xhr);
console.log(status);
});
});
</script>
</head>
<body>
</body>
</html>
Finally, the error
I read a little bit about CORS, but it's not working. The resources I found are the following, and still I don't know if I'm the one with the problem or the back-end code.
How to get a cross-origin resource sharing (CORS) post request working