我試圖使用$ .ajax()調用外部域,它工作時,服務器接收到調用,但在firebug錯誤中的響應出現在jquery.js行7760.我'我一整天都在打我的腦袋,並不覺得自己已經做得更好了。jQuery的Ajax跨域請求
$.ajax({
type: "GET",
url: "http://admin:[email protected]: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");
}
});
'jsonp'不支持'success' – diEcho 2012-07-16 06:48:26
指http://stackoverflow.com/a/10827375/946170 – Imdad 2012-07-16 06:50:53
@diEcho,可以請你發送一個鏈接來回復您的信息 – Imdad 2012-07-16 06:56:49