Houser's Blog

Technology && Art


  • 首页

  • 导航

  • 标签

  • 分类

  • 关于我

  • 归档

  • 代码片段

  • 搜索

AJAX/Fetch 在跨域情况下发送cookie并保持 sessionid一致

发表于 2017-08-18 | 分类于 笔记

Ajax

ajax在跨域发送请求的时候需要添加 xhrFields

1
2
3
4
5
6
7
8
9
10
11
12
13
$.ajax({
url:'example.com',
method:'post',
datatype:'json',
xhrFields: {
withCredentials: true
},
crossDomain: true,
data:param,
success:function(data){
console.log(data);
}
})

Fetch

fetch在跨域发送请求的时候需要添加 credentials: “include”

1
2
3
4
5
6
7
8
9
10
fetch('http://example.com',{
method:'post',
mode:'cors',
credentials: "include",
body: param
}).then((response)=>{
return response.json();
}).then((responseData)=>{
console.log(responseData);
});

参考:
Ajax跨域请求,同时保证session一致
Fetch API with Cookie

更换新的Blog系统

发表于 2017-08-06 | 分类于 随笔

经过长时间的调研,钻研,新的blog系统终于上线了

从wordpress,到个人用react+laravel开发,到现在的github pages

觉得目前的模式还是挺不错的,github,nodejs,markdown都是我非常喜欢的技术,这三者的结合希望能给我带来愉快的码字体验

当然最重要的还是多敲多写

好记性不如烂指头

Hello World

发表于 2017-08-06 | 分类于 笔记

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

1…45
Houser

Houser

43 日志
6 分类
44 标签
GitHub 知乎
© 2015 - 2021 Houser
鄂ICP备15011479号-3
由 Hexo 强力驱动
主题 - NexT.Pisces