我已经向服务器发送了一个POST reuqst,响应中有一个我需要存储的cookie
$.ajax({
type: "POST",
url: url + "api/Login",
headers: { "Authorization": headerData },
xhrFields: {
withCredentials: true
},
crossDomain: true,
dataType: "text"
}).then(
function (data, textStatus, jqXHR) {
// get the current default Breeze AJAX adapter
var ajaxAdapter = breeze.config.getAdapterInstance("ajax");
var cookies = document.cookie ? document.cookie.split('; ') : [];
for (var i = 0, l = cookies.length; i < l; i++) {
console.log(cookies[i]);
}
console.log('Cookie');
ajaxAdapter.defaultSettings = {
headers: {
// any headers that you want to specify.
"Cookie": jqXHR.getResponseHeader('Set-Cookie')
},
};
但是我不能退出cookie,我可以使用其他什么工具?
这是服务器响应
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Server: Microsoft-IIS/7.5
Set-Cookie: session-token=227c268d-dae5-4c54-a05a-90f2401592d3; domain=172.18.25.168; path=/
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 10 Dec 2013 20:47:07 GMT
Content-Length: 0
答案 0 :(得分:0)
为什么不在服务器端文件上回显/打印cookie,然后使用(数据)处理它?</ p>