Backbone.js - data not being populated in collection even though fetch is successful

后端 未结 2 1004
野性不改
野性不改 2020-12-01 20:17

I am trying to populate a collection from a simple JSON file as part of learning backbone.js. But I can\'t get it to work.

The AJAX call is made (verified with Fire

2条回答
  •  醉话见心
    2020-12-01 20:58

    i believe the problem lies in your json

    either you override the parse method on the collection, to work with your json

    or you could change the json :)

    [{
        "description": "Lorem ipsum..."
    },
    {
        "description": "Lorem ipsum..."
    }]
    

    i believe this is what your json should look like, just an array of your models.

提交回复
热议问题