跨域的Ajax GET请求 [英] Cross Domain Ajax get Request
本文介绍了跨域的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://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.
这篇关于跨域的Ajax GET请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文