跨域请求时携带cookie

$.ajax({
       type : "POST",
       url : url,
       cache: false,
       async : false,
       data : jsonData,
       dataType : 'json',
       timeout : 10000,
       crossDomain:true, //设置跨域为true
       xhrFields: {
           withCredentials: true //默认情况下,标准的跨域请求是不会发送cookie的
       },
       success : function(obj) {
           ......
       },
       error : function(data) {
           ......
       }
   });

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章