我尝试使用 $.ajax() 调用外部域并且它工作正常,服务器接收到调用,但是在 jquery.js 行 7760 中的 firebug 错误的响应。我一直在敲我的头这一切一天,不要觉得我已经做得更远了。
$.ajax({
type: "GET",
url: "http://admin:asdfg@149.50.143.241:81/stream.jpg",
//data: {},
//async: true,
//contentType: "application/jsonp; charset=utf-8",
//headers: {
// 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5',
// 'Accept': '*/*',
// 'Authorization': 'Basic ' + auth
//},
//timeout: 500,
dataType: "jsonp",
//crossDomain: true,
beforeSend: function (req) {
req.setRequestHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5');
req.setRequestHeader('Accept', '*/*');
req.setRequestHeader('Authorization', 'Basic ' + auth);
},
success: function (data) {
alert("Success");
}
});