Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var router = {
- //...
- init : function() {
- this.getData("api/movies", "movies", callback);
- },
- getData : function (url, htmlType, callback) {
- $.ajax({
- url: url,
- dataType: 'json',
- success: function (response) {
- if (response && response.length > 0) {
- this.printMovies(response, callback); //'this' refers to ajax
- this.printMovies(response, callback).bind(this) //still doesn't work
- }
- },
- error: function (response) { console.log("Error:" + response); }
- });
- },
- printMovies : function(){
- },
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement