Firefox's cross-domain request failed?

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,
})
Jan.11,2022

continued to search for this problem today, and finally found a solution. My problem has been solved, and now write down the solution below.
I found the solution in a blog,
blog address: https://www.jianshu.com/p/292.
cannot be parsed in firefox if Access-Control-Allow-Headers and Access-Control-Allow-Methods are set to * when bloggers say they are cross-domain, because the http specification is recommended to clearly indicate the allowed Headers and Methods. Therefore, these two items need to be clearly pointed out in order for firefox to have cross-domain access.
after I explicitly pointed out these two items in the back-end code according to my own situation, firefox succeeded in cross-domain.

Menu