function getMovie(movie_id, callback) { params = $.toJSON({movie_id : movie_id}); method = 'getMovie'; execute(method, params, callback); } function deleteMovieFromUser(movie_id, callback) { params = $.toJSON({movie_id : movie_id}); method = 'deleteMovieFromUser'; execute(method, params, callback); } function getNewestMovies(page, results_per_page, callback) { params = $.toJSON({page : page, results_per_page : results_per_page}); method = 'getNewestMovies'; execute(method, params, callback); } function getFlaggedMovies(callback) { params = $.toJSON({}); method = 'getFlaggedMovies'; execute(method, params, callback); } function getBestViewedMovies(page, period, results_per_page, callback) { params = $.toJSON({page : page, period : period, results_per_page : results_per_page}); method = 'getBestViewedMovies'; execute(method, params, callback); } function getBestRatedMovies(page, period, results_per_page, callback) { params = $.toJSON({page : page, period : period, results_per_page : results_per_page}); method = 'getBestRatedMovies'; execute(method, params, callback); } function getLastViewedMovies(callback) { params = $.toJSON({}); method = 'getLastViewedMovies'; execute(method, params, callback); } function addCommentToMovie(movie_id, name, comment_text, callback) { params = $.toJSON({movie_id : movie_id, name : name, comment_text : comment_text}); method = 'addCommentToMovie'; execute(method, params, callback); } function getCommentsForMovie(movie_id, callback) { params = $.toJSON({movie_id : movie_id}); method = 'getCommentsForMovie'; execute(method, params, callback); } function flagComment(comment_id, callback) { params = $.toJSON({comment_id : comment_id}); method = 'flagComment'; execute(method, params, callback); } function rateMovie(movie_id, rating, callback) { params = $.toJSON({movie_id : movie_id, rating : rating}); method = 'rateMovie'; execute(method, params, callback); } function flagMovie(movie_id, callback) { params = $.toJSON({movie_id : movie_id}); method = 'flagMovie'; execute(method, params, callback); } function sendAFriend(movie_id, recipients, sender, message, callback) { params = $.toJSON({movie_id : movie_id, recipients : recipients, sender : sender, message : message}); method = 'sendAFriend'; execute(method, params, callback); } function execute(method, params, callback) { $.post('http://www.zeelandnet.nl/video/api', { method: method, params: params }, function(data) { if(typeof(callback) == 'function') { callback(data); } } , 'json'); }