跨域的Ajax GET请求Ajax、GET

由网友(蓉嬷嬷当年一枝花)分享简介:我想问一下跨域问题通过Ajax GET请求。我的Ajax请求就是这样I'd like to ask a question for cross-domain Get request via Ajax.My ajax request is Like that var currency_path="http://f...

我想问一下跨域问题通过Ajax GET请求。 我的Ajax请求就是这样

I'd like to ask a question for cross-domain Get request via Ajax. My ajax request is Like that

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);             
});

我得到的回应,但我不能跟踪的 任何建议?

I got the response but i can't trace that Any Suggestion ?

推荐答案

看在你的JavaScript错误控制台:

Look in your JavaScript error console:

未捕获的SyntaxError:意外的标记:

Uncaught SyntaxError: Unexpected token :

数据类型:JSONP,,但该URL返回JSON

You have dataType:'jsonp', but the URL is returning JSON.

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

You can't parse JSON as JSONP, there are different data formats.

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

Use some other technique to access the data.

阅读全文

相关推荐

最新文章