Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
Brothers I have omdb api key. But i don't know how to grab information of any movie into separate textbox or textarea in codeignitor using json or jquery. Anyone help me and give complete code example?

http://www.omdbapi.com/?i=tt3896198&apikey=XXXXXXX

thanks

What I have tried:

I have no code. because i don't know bout json..
Posted
Comments
Karthik_Mahalingam 24-Jan-18 7:20am    
what is the json value you are getting?

copy paste this url in browser and see the json data
http://www.omdbapi.com/?i=tt3896198&apikey=Your_key
Member 11066390 24-Jan-18 7:33am    
html code:

{{ movieResult.Title }}




Type {{ movieResult.Type }} Country {{ movieResult.Country }} Runtime {{ movieResult.Runtime }} IMDB Rating {{ movieResult.imdbRating }} Released date {{ movieResult.Released }} Director {{ movieResult.Director }} Genre {{ movieResult.Genre }} Writer {{ movieResult.Writer }}


JS code:
//Module
var movieApp = angular.module('movieApp', ['ngRoute', 'ngResource']);


//Routes
movieApp.config(['$routeProvider',function($routeProvider) {

$routeProvider

.when('/', {
templateUrl: "views/main.html",
controller: "mainController"
})

.when('/movierating', {
templateUrl: "views/movierating.html",
controller: "movieratingController"
})

}]);

//Service

movieApp.service('movieService', function(){

this.movieName = "";

});



//Controllers
movieApp.controller('mainController', ['$scope', '$log', '$resource', 'movieService', function($scope, $log, $resource, movieService){

$scope.movieName = movieService.movieName;

$scope.$watch('movieName', function(){
movieService.movieName = $scope.movieName;
});


}]);

movieApp.controller('movieratingController', ['$scope', '$log', '$resource', '$routeParams', 'movieService', function($scope, $log, $resource, $routeParams, movieService){

$scope.movieName = movieService.movieName;

$scope.movieAPI = $resource("https://www.omdbapi.com/?",
{
get: {
method: "JSONP",
isArray: true,
callback: "JSON_CALLBACK"
}

});

$scope.movieResult = $scope.movieAPI.get({
t: $scope.movieName
});

console.log($scope.movieResult);


}]);
Member 11066390 24-Jan-18 7:43am    
i use my key and get this kind of data into my browser.
{"Title":"Guardians of the Galaxy Vol. 2","Year":"2017","Rated":"PG-13","Released":"05 May 2017","Runtime":"136 min","Genre":"Action, Adventure, Sci-Fi","Director":"James Gunn","Writer":"James Gunn, Dan Abnett (based on the Marvel comics by), Andy Lanning (based on the Marvel comics by), Steve Englehart (Star-lord created by), Steve Gan (Star-lord created by), Jim Starlin (Gamora and Drax created by), Stan Lee (Groot created by), Larry Lieber (Groot created by), Jack Kirby (Groot created by), Bill Mantlo (Rocket Raccoon created by), Keith Giffen (Rocket Raccoon created by), Steve Gerber (Howard the Duck created by), Val Mayerik (Howard the Duck created by)","Actors":"Chris Pratt, Zoe Saldana, Dave Bautista, Vin Diesel","Plot":"The Guardians must fight to keep their newfound family together as they unravel the mystery of Peter Quill's true parentage.","Language":"English","Country":"USA, New Zealand, Canada","Awards":"6 wins & 21 nominations.","Poster":"https://images-na.ssl-images-amazon.com/images/M/MV5BMTg2MzI1MTg3OF5BMl5BanBnXkFtZTgwNTU3NDA2MTI@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"7.8/10"},{"Source":"Rotten Tomatoes","Value":"83%"},{"Source":"Metacritic","Value":"67/100"}],"Metascore":"67","imdbRating":"7.8","imdbVotes":"322,401","imdbID":"tt3896198","Type":"movie","DVD":"22 Aug 2017","BoxOffice":"$389,804,217","Production":"Walt Disney Pictures","Website":"https://marvel.com/guardians","Response":"True"}
F-ES Sitecore 24-Jan-18 7:31am    
That's not an official API, if you use it you're effectively stealing IMDB's data.
Member 11066390 24-Jan-18 7:40am    
i have purchased omdb api key already... I don't know how to write a perfect code to fetch all detail and display at my text box for auto filling..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900