From 25e9206efb37101de1f663868275978856ecd8ec Mon Sep 17 00:00:00 2001 From: binaryify Date: Fri, 3 Jul 2020 11:52:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0test.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/test.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/test.html b/public/test.html index 4d30961..804bd92 100644 --- a/public/test.html +++ b/public/test.html @@ -22,6 +22,9 @@ } $.ajax({ url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}`, + xhrFields: { + withCredentials: true //关键 + }, success: function(data) { console.log(data) $.ajax({ @@ -43,7 +46,8 @@ }) axios({ - url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}` + url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}`, + withCredentials: true //关键 }).then(function(res) { console.log(res.data) axios({