Using Backbone.js, I would like to get data from the Json file in the client when I call the fetch method in an instance of a model or collection.
url propertyin my collection ( MyCol) points to the following json file, which looks like this:
[
{title: "_My trip to Bali", src: "bali-trip.jpg"},
{title: "_The flight home", src: "long-flight-oofta.jpg"},
{title: "_Uploading pix", src: "too-many-pics.jpg"}
]
I execute the following commands:
myCol = new MyCol();
myCol.fetch();
myCol.toJSON();
source
share