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 ?
Look in your JavaScript error console:
Uncaught SyntaxError: Unexpected token :
You have dataType:'jsonp',
but the URL is returning JSON.
You can't parse JSON as JSONP, there are different data formats.
Use some other technique to access the data.