Im working with some gaming api, which upon request returns data in json format.
The problem is, api is on different domain so I'm not allowed to use dataType: "json" because of cross domain policy (error: No 'Access-Control-Allow-Origin' header is present on the requested resource). So I tried to use jsonp instead. When I use jsonp, jQuery throws parseError, since data from server is json and not jsonp.
I already tried jsonpCallback and everything of this kind - server still returns json.
I also tried to use xhr.responseText, but is empty. Is there ANY way to just tell jQuery not to parse data - I can parse the string manually, just datatype has to be set on jsonp for server to respond correctly.
And the data is returned from server. I know it is not empty, I can inspect it using developer tools in chrome.
My code:
$.ajax({
url: "http://eu.battle.net/api/wow/character/turalyon/Blargh",
type: "get",
data: { fields: "quests" },
dataType: "json",
success: function(data, textStatus, jqXHR){
if(typeof func === "function"){
func(data);
}
},
error: function(jqXHR, textStatus, errorThrown){
contentField.html(textStatus);
}
});