I have next ajax request usnig jquery in my react app, here is this request:
index.js
$.ajax({
type: "POST",
url : 'http://localhost/my-app/server/send.php',
"async": true,
"crossDomain": true,
"headers": {
"accept": "application/json",
"Access-Control-Allow-Origin":"*"
}
}, function(data) {
alert(data, "success!")
})
send.php
<?
header("Access-Control-Allow-Origin: *");
echo "...response...";
But my ajax call raises an error in console:
Access to XMLHttpRequest at 'http://localhost/my-app/server/send.php' from origin
'http://localhost:3000' 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
But I send headers, what is wrong?