a网站去登录b网站
a网站的ajax代码
$.ajax({ type: 'GET', url: path+"api/login/login.php", data: data, dataType: 'json', cache: false, async: false, xhrFields:{ withCredentials: true }, success: function (re) { if (re.code == 0) { newTab.location.href = path; } else { ymPrompt.errorInfo(re.msg); return false; } } });b网站的php接收代码
header('Access-Control-Allow-Origin:http://ct.medo2o.cn'); header('Access-Control-Allow-Credentials: true');