pickab00
8 months ago

Getting Ajax undefined response

Posted 8 months ago by pickab00

I keep getting undefined when I try to take a specific value from my response. Here is my response.

{Title: "Need for Speed", Year: "2014", Rated: "PG-13", Released: "2014-03-14", Runtime: 132,…}
Actors: ["Aaron Paul", "Dominic Cooper", "Imogen Poots", "Kid Cudi"]
Awards: "1 win & 2 nominations."
BoxOffice: ",138,026"
Country: ["USA", "India", "UK", "France", "Philippines"]
DVD: "05 Aug 2014"
Director: "Scott Waugh"
Genre: ["Action", "Crime", "Thriller"]
Language: "English"
Metascore: 39
Plot: "Framed by an ex-partner for a murder he did not commit, Tobey Marshall, a     financially struggling custom-car builder and street-racer, spends two years in jail thinking     about one moment. Fresh out of prison he reacquires the fastest car his workshop ever built     and sold, and seeks to enter a secretive and extremely high-stakes race known as The DeLeon.     His purpose; redemption, recognition from the world of racing and to solve his problems. Yet     all this fades in comparison to his driving reason. Revenge. Above all, revenge. This is a story     about love, redemption, revenge and motor oil all swirled together"
Poster: "https://m.media-    amazon.com/images/M/[email protected]_V1_S    X300.jpg"
Production: "Walt Disney Studios"
Rated: "PG-13"
Ratings: [{Source: "Internet Movie Database", Value: "6.5/10"}, {Source: "Rotten Tomatoes",         Value: "23%"},…]
Released: "2014-03-14"
Response: true
Runtime: 132
Title: "Need for Speed"
Type: "movie"
Website: "http://TheNeedForSpeedMovie.com"
Writer: ["George Gatins (screenplay)", "George Gatins (story)", "John Gatins (story)"]
Year: "2014"
imdbID: "tt2369135"
imdbRating: 6.5
imdbVotes: 152182
tomatoConsensus: null
tomatoFresh: null
tomatoImage: null
tomatoMeter: null
tomatoRating: null
tomatoReviews: null
tomatoRotten: null
tomatoURL: "http://www.rottentomatoes.com/m/need_for_speed/"
tomatoUserMeter: null
tomatoUserRating: null
tomatoUserReviews: null

And here is my AJAX,

$.ajax({
    //type: "POST",
    url: "http://127.0.0.1:8001/omdb/search.php",
    dataType: "JSON",
    data: { search: param},
    
    success: function(data) {

        //Set data.name.
        //$(".title").val(data.Title);

   
            console.log(data.Title);
    }


});

I am trying to get the title but it shows undefined. Using just data gives me the json.

Please sign in or create an account to participate in this conversation.