Ajax cannot get cookie

when you use axios to get data in a project, you can"t get cookie,. You can"t even set it up countless times according to the method on the Internet. After that, you want to do a test with ajax. The front-end code is as follows

.
var x = new XMLHttpRequest()
x.withCredentials =true
x.open("GET", "http://a.com");
x.setRequestHeader("lang", "zh");
x.onload=function(){
    console.log(x.responseText);
};
x.send();

still cannot get the cookie, response header as follows

Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: x-requested-with, Content-Type,Cookie, Accept, multipart/form-data, application/x-www-form-urlencoded, lang, token, os, version, time
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
Access-Control-Allow-Origin: http://192.168.0.128:8020
Cache-Control: no-cache, must-revalidate, no-cache, private
Connection: close
Content-Type: application/json
Date: Thu, 06 Sep 2018 10:27:57 GMT
Pragma: no-cache
Proxy-Connection: keep-alive
Server: nginx/1.13.12
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Powered-By: PHP/7.2.5

request headers are as follows

lang: zh
Origin: http://192.168.0.128:8020
Referer: http://192.168.0.128:8020/test/new_file.html?__hbt=1536228082860
User-Agent: Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Mobile Safari/537.36

from the response head, there is no problem with the Access-Control-Allow-Credentials: true set in the background. I don"t know what the problem is. Ask the boss for advice!

May.30,2021

if AJAX acquires COOKIE, you want the backend to set cookie and return


configuration. I think it's OK to make sure there is cookie, and check the domain and httponly of cookie first.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b4c4-2c287.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b4c4-2c287.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?