是否可以使用jQuery将Cookie从一个域传递到另一个域?

时间:2019-05-15 17:29:41

标签: javascript jquery

我有一个使用jquery post从一个域生成的cookie,如下所示?

  $.ajax({
        url: _domainURL1 + '/domain1/auth/start',
        type: 'POST',
        dataType: 'text',
        cache: false,
        crossDomain: true,
        xhrFields: { withCredentials: true },
        data: $('#data').val(),
        success: function (data) {

        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert(thrownError);
        }
        complete: getCookie
    });


    function getCookie() {
         if (document.cookie) {
                $('#cookie').val(document.cookie);
            }
    }

是否可以在以下请求中附加从domain1生成的#cookie?

var data = {
                Type: "test1",
                ID: "testid1"
            };

         $.post(_domainURL2 + '/domain2/senddata', data, function (result) {
                alert("complete");
            });

0 个答案:

没有答案
相关问题