Im working on a personal jQuery/ajax/json project, and i am trying to collect data from the TMDB API. Where I want people to search for a certain term, for example the movie Fight Club. What should happen is that see a movie poster which matches the movie title entered.
I got this so far:
$.ajax({ type: "GET", dataType: "jsonp", cache: false, url: "https://api.themoviedb.org/3/search/movie?api_key=257654f35e3dff105574f97fb4b97035&query=fight+club", success: toonTMDBresults // at succes, run the function toonTMDBResults });
        function toonTMDBresults(tmdbJson) {
                console.log('TMDB:', tmdbJson);
                if ( 1 == 1 ) { // if 1 equals 1, so always run the following code... :)
                    for (var idx in tmdbJson.data) { //loop through the results
                        var results = tmdbJson.data[idx];
                        console.log(results);
                       console.log(results.results[0].id);  //take the ID of the first result in the array
                    }
                } else {
                    console.log('problem with the TMDB request:', json.meta.code);
                }
What I wanted to happen is that I see the Id of the movie in my console. If I am able to do that, I would be able to select the poster_path from the json data and show the movie poster in my html.
But the problem is I am not getting the ID in my console as I requested, so i am doing something wrong.
Thanks,
Mark
 
     
     – kobigurk
                Jul 03 '14 at 07:59
        – kobigurk
                Jul 03 '14 at 07:59