Reputation: 13
i am trying to learn backbone.js trying to get data from php then display it by model, view and route of backbone.js
but its not displaying my data, it displaying [object Object]
you can see output here:: http://php-backbone.gopagoda.com/
and the source code:: https://github.com/foysal-mamun/php-backbone
i have console.log my this.model, you can see my data in:: this.model.attributes.message
please help me how can i fix this. Thanks.
Upvotes: 1
Views: 226
Reputation: 5308
Change like below in your router.
this.messageModel.fetch({success: function () {
$('#msg').html(this.messageView.render().el);
}}
and change like below in your render function.
$(this.el).html(this.template(this.model.attributes));
Upvotes: 1