跨域Ajax获取请求

时间:2014-09-03 05:36:59

标签: javascript ajax cross-domain

我想通过Ajax向跨域Get请求提问。 我的ajax请求就像那样

var currency_path="http://forex.cbm.gov.mm/api/latest";

$.ajax({  
    url: currency_path,  
    crossDomain:true,  
    type:"GET",  
    dataType:'jsonp',  
    async:false,  
    success: function(data){  
        console.log(data);  
 },  
error: function(){  
     alert('failure');  
}  
}).done(function(msg) {  
    console.log(msg);             
});

我收到了回复,但我无法追查 有什么建议吗?

1 个答案:

答案 0 :(得分:0)

查看JavaScript错误控制台:

  

Uncaught SyntaxError:意外的令牌:

您有dataType:'jsonp',但网址正在返回JSON。

您无法将JSON解析为JSONP,存在不同的数据格式。

使用其他一些技术来访问数据。

相关问题