$.ajax({
type: "POST",
dataType: "json",
url: "xxxxxxxxxxxxxxxxxxxxxxxxxx",
//contentType: "application/json; charset=UTF-8",
crossDomain: true,
//xhrFields: { withCrendentials: true },
// beforeSend: function (req) {
// req.setRequestHeader('Access-Control-Allow-Origin', '*');
// req.setRequestHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
// req.setRequestHeader("Access-Control-Allow-Headers", "Content-Type, Accept");
//req.setRequestHeader("Authorization", "ST signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
// req.setRequestHeader("X-Mobile","false");
// },
headers: {
"Authorization": "ST signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
},
data: source,
timeout: 10000,
success: function (data) {
Chrome控制台上的我遇到了这个错误
XMLHttpRequest无法加载url:xxxxxxxxxxxxxxxxxxx。 No' Access-Control-Allow-Origin'标头出现在请求的资源上。起源' http://localhost:53208'因此不允许访问
在Mozilla控制台上我遇到了这个错误
阻止跨源请求:同源策略禁止在url:xxxxxxxxxxxxxxxxxxxxxxxxx处读取远程资源。 (原因:CORS标题' Access-Control-Allow-Origin'缺失)。