jquery ajax从响应头获取Set-cookie

时间:2017-10-14 06:55:18

标签: javascript jquery ajax cookies

我没有从响应头获取Set-Cookie值。值throw null

reflexive, antisymmetric and transitive

我的代码

$.ajax({
    url: ip_add + '/' + reqUrl,
    crossDomain: true,
    type: "POST",
    dataType: "json",
    data: req_data,
    xhrFields: {
        withCredentials: true
    },
    beforeSend: function(xhr) {
        xhr.setRequestHeader("X-CSRFToken", csrftoken);
    },

    success: function (res, textStatus, XMLHttpRequest) {      
        var cookietoSet = XMLHttpRequest.getResponseHeader('Set-Cookie');
        alert(cookietoSet);
    },
    cache: false, 
});

0 个答案:

没有答案