【发布时间】:2014-01-20 02:22:38
【问题描述】:
如果服务器没有响应 JSONP,我应该如何处理?我用 $.ajax 尝试了几个选项,但无法让它工作。
//var url = 'https://coinbase.com/api/v1/currencies/exchange_rates';
var url = 'http://blockchain.info/ticker';
$.ajax({
type: 'GET',
url: url,
//jsonpCallback: 'jsonCallback',
contentType: 'application/json',
//async: false,
//dataType: 'jsonp',
//xhrFields: {
// for CORS?
// withCredentials: false
//},
success: function (json) {
debugger;
},
error: function (json) {
debugger;
}
});
【问题讨论】:
-
我无法更改服务器设置,但我正在尝试使用 XmlHttpRequest 的示例。