Reputation: 671
I am trying to access the codeforces api and they are providing a JSON(but not JSONP) as I'm making a cross domain request, it should be JSONP.
So, I'm using a third party json2jsonp, and it works.
var cfurl = "http://json2jsonp.com/?url=http://codeforces.com/api/user.info?handles=";
var runUserRequest = function(handle){
return $http({
method: 'JSONP',
url: cfurl + handle + "&callback=cfhandle"
})
}
Finally, my doubt is is there some elegant way to do this without using the third parties like json2jsonp
Thanks in advance
Upvotes: 1
Views: 285
Reputation: 24617
is there some elegant way to do this without using the third parties like json2jsonp
Use one of the following options:
References
how can I deactivate cross-site scripting defense on my own browser?
How do I disable the access denied message when trying to do cross scripting into an iframe?
Upvotes: 1