cors跨域的前端实现---根据资料整合的
1.服务端
搁response中增加Access-Control-Allow-Origin:‘*’
eg: context.Response.AddHeader(
"Access-Control-Allow-Origin"
,
"*"
);
2.前端
同样发送ajax请求
$.ajax({
type:'method' //GET POST HEAD都行
url:‘croll-domain-url’,
xhrFields:{
withCredentials:true //允许带cookie跨域
},
headers:{...},
success:function() {...},
error:function() {...}
})