OK, a super basic layout question - I searched all around, but too slowly to get it, despite a lot of similar questions. Be sure I'm ashamed.
In any case, self-flagellation is enough - why doesn't it?
var app = app || {}; app.Option = Backbone.Model.extend({ url: 'http://localhost:4711/api' //This url contains the following JSON: {"title": "Blahblah", "author": "Luke Skywalker"}; }); app.View = Backbone.View.extend({ el: 'body', initialize: function(){ this.model.fetch(); this.model.bind('change', this.render(), this); }, render: function(){ this.$el.html(this.model.get('title')); return this; } }); $(function() { var option = new app.Option(); this.homeView = new app.View({ //Tried changing this to a standard var declaration but didn't work model: option }); this.homeView.render(); });
So, I expect to see JSON "Blahblah" on the screen, but I do not see anything. JSON is correctly selected (I see a successful GET request in the firebug console), and I think I made sure that the data is retrieved before I try to execute it ...
So what happened? The console gives me this error: "TypeError: (intermediate value) .callback.call is not a function"
Thanks!
source share