This is my code, I'm using it in a react redux app.
const devOptions = {
url: `${TMDB_URL}${TMDB_API_KEY}${TMDB_LANGUAGE}&query=${searchTerm}${TMDB_SEARCH_PARAMS}`,
method: 'GET',
dataType: 'jsonp',
jsonpCallback: 'test'
}
const request = axios(devOptions)
Still getting cors issue with datatype as jsonp.
Не можете да откриете филм или сериал? Влезте, за да го създадете.
Искате ли да го оцените или добавите към списък?
Нямате профил?
Отговор от martymclaugh@gmail.com
на 26 януари 2017 в 8:43 PM
I have no idea why, but it started working once I took out "method: 'GET'"
Отговор от Travis Bell
на 28 януари 2017 в 11:25 AM
That is weird, must be some kind of policy that is enforced in one case, but not the other. In any case, I believe I have an open ticket to look at this.
Regardless, I'm happy you figured out a way around it ;)
Отговор от martymclaugh@gmail.com
на 28 януари 2017 в 4:28 PM
It's even working without the jsonp datatype from localhost now,
Works just fine. Maybe it has something to do with the promise middleware I added to redux?
Отговор от Travis Bell
на 29 януари 2017 в 11:41 AM
Maybe! But I don't know anything about React so...