1

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

venkatvb
  • 681
  • 1
  • 9
  • 24

1 Answers1

1

is there some elegant way to do this without using the third parties like json2jsonp

Use one of the following options:

  • A reverse proxy server
  • A greasemonkey script
  • Browser settings

References

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265