JSONP Error.

Avatar image for adrianrodriguez
adrianrodriguez

16

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

I've been searching for a few hours between this weekend and today to figure out this issue when trying to hit the API via Angular and Ajax but getting the No Access-Control-Allow Origin error.

Are we allowed to do AJAX requests to hit the API or are we supposed to be doing this through a server? I tried doing it via jsonp, but then I get unexpected token errors?

I feel like the documentation for the API is not thorough, I had to dig through the forums just to figure out the proper url/parameters for the api.

Would love some assistance on this.

Avatar image for adrianrodriguez
adrianrodriguez

16

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#2  Edited By adrianrodriguez

I actually figured out my own problem eventually and here is some code to help you guys out for the future trying to hit the API using Angular JS and JSONP:

$http.jsonp('http://www.comicvine.com/api/search/?api_key=' + api_key + '&format=jsonp&limit=20&offset=0&query=' + $scope.search + '&resources=character&field_list=image,real_name,name,deck&json_callback=JSON_CALLBACK')