所以我創建了一個使用rails-api gem的rails api。我把我的骨幹代碼放在默認的public/index.html中。我嘗試了json鏈接並返回json,它只是一個名爲'entry'的模型,其中包含一個名爲'content'的字段以及一些默認的rails字段。但骨幹代碼不起作用,你能發現這個問題嗎?我只是試圖從返回的json中顯示記錄列表。簡單的骨幹示例與導軌api
// Models window.Entry = Backbone.Model.extend(); window.EntryCollection = Backbone.Collection.extend({ model:Entry, url:"http://localhost:3000/entries" }); // Views window.EntryListView = Backbone.View.extend({ tagName:'ul', initialize:function() { this.model.bind("reset", this.render, this); }, render:function (eventName) { _.each(this.model.models, function (entry) { $(this.el).append("
看到這個鏈接= https://github.com/documentcloud/backbone和嘗試這個 –