繁体   English   中英

跨域Ajax获取请求

[英]Cross Domain Ajax get Request

我想通过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);             
});

我得到了答复,但我找不到任何建议?

在您的JavaScript错误控制台中查看:

未捕获到的SyntaxError:意外令牌:

您具有dataType:'jsonp',但是URL返回JSON。

您不能将JSON解析为JSONP,有不同的数据格式。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM