Accessing APIv2 with Javascript and/or CORS

A place for developers to advertise their enabled app and get help from other developers with the API.
Posts: 1
Joined: Tue Feb 20, 2018 7:35 pm

Accessing APIv2 with Javascript and/or CORS

Postby matt.lawrence » Tue Feb 20, 2018 8:46 pm

Is there any way to access the API v2 via Javascript or CORS? I've been searching on this forum and Google and have found very little information on such a venture.

My specific use case requires my API calls to work in a Cordova app, so therefore I'm limited to HTML, CSS, and JS.

Every time I use CORS or pure AJAX I get a cross domain request error, despite CORS being built for cross-domain requests.

I have a full writeup of what I'm trying to accomplish with more technical details on this Reddit thread -

If CORS is not allowed as a way to request info, any alternative methods that would work in a Cordova app would be appreciated. I'm using this project to learn WebAPIs so any specific details you could provide in a possible solution would be very much appreciated.

Posts: 3
Joined: Sat Jul 21, 2018 11:57 pm
Location: france

Re: Accessing APIv2 with Javascript and/or CORS

Postby JO_MELNIK » Sun Jul 22, 2018 1:28 am

in javascriptt you get 405 error (Cross-origin resource sharing (CORS)) because you use XMLHttpRequest with a remote domain.
But XMLHttpRequest works with a file on your server, you just have to create a server-side scripting file (like php), on your server, which sends your requests to and which return the tvdb JSON results.

[email protected] -> [email protected] -> [email protected] -> [email protected] -> [email protected]