Advertisement
Guest User

Untitled

a guest
May 30th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. var router = {
  2.  
  3. //...
  4. init : function() {
  5. this.getData("api/movies", "movies", callback);
  6. },
  7. getData : function (url, htmlType, callback) {
  8. $.ajax({
  9. url: url,
  10. dataType: 'json',
  11. success: function (response) {
  12. if (response && response.length > 0) {
  13. this.printMovies(response, callback); //'this' refers to ajax
  14. this.printMovies(response, callback).bind(this) //still doesn't work
  15. }
  16. },
  17. error: function (response) { console.log("Error:" + response); }
  18. });
  19. },
  20. printMovies : function(){
  21.  
  22. },
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement