简体   繁体   English

JQuery.post从服务器获取cookie,但未在我的计算机上设置它们

[英]JQuery.post gets cookies from server but not settings them on my computer

I'm using JQuery.post in order to login into an API, the POST request works but the cookie that is being sent back from the server isn't being set on my computer. 我使用JQuery.post来登录API,POST请求有效,但未在我的计算机上设置从服务器发送回的cookie。

Does anyone knows a way to set the cookie that was retrieved from the server? 有谁知道一种方法来设置从服务器检索到的cookie?

With javascript you can set a cookie this way: 使用javascript,您可以通过以下方式设置Cookie:

document.cookie="name=value";

So you can parse the response from the server and set the cookie. 因此,您可以解析服务器的响应并设置cookie。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM