the domain name of the following code has been replaced by xxxx
warning of the Firefox console
Cross-source requests have been blocked: the same origin policy forbids reading of remote resources located in xxxx. (reason: the CORS request was unsuccessful).
the environmental background of the problems and what methods you have tried
there is nothing wrong with the Chrome test, only errors are reported under Firefox and the request cannot be successful.
search questions through search engines, and it is useless to set header such as Access-Control-Allow-Origin: *.
PHP
header("Access-Control-Allow-Origin: xxxxx");
header("Access-Control-Allow-Credentials: true");
JS
/* */
$.ajax({
type: "POST",
url: url,
data: {
"username": username,
"c": c,
},
success: function (data) {
console.log(data);
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
})