Client Settings 1. Native JS setting mode:
true; '
2.jQuery or Zepto setting mode:
$.ajax ({ ... Xhrfields: { true }, ...})
By default, cross-origin requests do not provide credentials (cookies, HTTP authentication, and client SSL certificates, etc.). By setting the Withcredentials property to True, you can specify that a request should send credentials. This allows the cross-domain cookie to be shared, such as your two-level domain to get a cookie for your first-level domain name or vice versa. Service-Side settings The following is the settings for the PHP version:
Header ("Access-control-allow-credentials:true");
If a request with a credential is sent, but the server does not contain the header, the browser does not give the corresponding data to JavaScript. As a result, the responsetext will be an empty string, the status value is 0, and the OnError () event handler will be called.
Ajax cross-domain request cannot carry cookie problem