Sprijin Bază de date filme (The Movie Database)

I have an API key that I am using for a site I am working on. I had to change the URL and now I get a cross domain error. I was wondering whether I can add a URL (or two, really, one being localhost for development) that I can use with my API key. I'm really not even 100% sure that this is the issue.

Thank you!

3 răspunsuri (pe pagina 1 din 1)

Jump to last post

Hi blkmutt,

You'll need to use JSONP to get around this problem, it's not something that we control. You can read more about this here. You can call our API as JSONP by including a callback parameter. Example:

https://api.themoviedb.org/3/movie/550?api_key=###&callback=test

Cheers.

Hi Travis,

Thanks for the response. I've tried this a couple of ways, one of which is your suggestion. I get the following still:

XMLHttpRequest cannot load http://api.themoviedb.org/3/configuration?api_key={my_api_key}&callback={my_callback_function}. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:3000' is therefore not allowed access.

Also, I've tried setting the Accept header to 'application/jsonp' and I have the same problem.

Any idea why I'd still be getting this?

Thanks again for the help!

Hi blkmutt,

What library are you using? I am fairly positive a wildcard (*) is perfectly valid for the Access-Control-Allow-Origin header. I have a working jQuery test you can see here (add your API key on line 11).

Nu găsiți un film sau un serial? Autentificați-vă pentru a-l crea.

Globale

s focalizează bara de căutare
p deschide meniul profilului
esc închide o fereastră deschisă
? deschide fereastra cu scurtături de la tastatură

Pe paginile media

b mergi înapoi (sau la părinte atunci când este cazul)
e mergi la pagina de editare

Pe paginile sezoanelor filmelor seriale

(săgeată dreapta) mergi la sezonul următor
(săgeată stânga) mergi la sezonul precedent

Pe paginile episoadelor filmelor seriale

(săgeată dreapta) mergi la episodul următor
(săgeată stânga) mergi la episodul precedent

Pe toate paginile de imagini

a deschide fereastra pentru adăugarea de imagini

Pe toate paginile de editare

t deschide selectorul de traduceri
ctrl+ s trimite formularul

Pe paginile de discuții

n crează o discuție nouă
w comută starea de vizionare
p comută publică/privată
c comută închisă/deschisă
a deschide activitatea
r răspunde la discuție
l mergi la ultimul răspuns
ctrl+ enter trimite mesajul
(săgeată dreapta) pagina următoare
(săgeată stânga) pagina precedentă

Setări

Doriți să evaluați sau să adăugați acest articol într-o listă?

Autentificare