ajax获取set-cookie,javascript - Ajax Set-Cookie Header Response - Stack Overflow

I have a project which using a a REST API. Here when I send a login request, they are sending me the response as JSON containg some data. Along with that in Response Header

Access-Control-Allow-Origin:*

Cache-Control:private

Content-Encoding:gzip

Content-Length:49

Date:Sun, 28 Jul 2013 08:09:29 GMT

ntCoent-Length:36

Server:Apache-Coyote/1.1

Set-Cookie:JSESSIONID=044F94AFE2997F02475315474E3B822D; Path=/

Set-Cookie:NSC_Ibgja-IUUQt=ffffffffc3a0b60545525d5f4f58455e445a4a4229a0;expires=Sun, 28-Jul-2013 08:55:40 GMT;path=/;secure

X-Powered-By:Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA

Here we have a Set-Cookie , but this cookie is not setting. I need this cookie to be setted, because for any other API access, the server will check for this cookie.

How can I resolve this Issue? What is the solution for jQuery AJAX response Header Set-Cookie method?

Update:

the first ajax for login

var json='{"nin":"'+1080258278+'","password":"'+840622+'"}';

var hostURL = "https://www.hafiz.gov.sa";

$.ajax({

type: "POST",

url: hostURL + "/HRDFWeb/AuthenticateDirectly",

data: "json="+json+"&date="+Number(new Date()),

dataType: "json",

timeout: 180000, // in milliseconds

success: function(data, textStatus, XMLHttpRequest){

console.log(data);

},

error: function(request, status, err) {

}

});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值