【java|使用shiro前后端分离时,获取不到session】前端必须要在ajax请求里加上xhrFields: {withCredentials: true}, crossDomain: true。
$.ajax({
url: xxx/xxx
// 将XHR对象的withCredentials设为true
xhrFields: {
withCredentials: true
},
crossDomain: true
});
推荐阅读
- Java|Java基础——数组
- 人工智能|干货!人体姿态估计与运动预测
- web网页模板|如此优秀的JS轮播图,写完老师都沉默了
- java简介|Java是什么(Java能用来干什么?)
- Java|规范的打印日志
- Linux|109 个实用 shell 脚本
- 接口|axios接口报错-参数类型错误解决
- 程序员|【高级Java架构师系统学习】毕业一年萌新的Java大厂面经,最新整理
- JavaScript|vue 基于axios封装request接口请求——request.js文件
- JavaScript|JavaScript — 初识数组、数组字面量和方法、forEach、数组的遍历