I am having trouble with the formatting of my .json file while using backbone.js. I can't seem to pass in the url
correctly.
PlayersCollection = Backbone.Collection.extend({
model: Player,
url: 'http://localhost/STEPS/data/players.json',
//localStorage: new Backbone.LocalStorage("players-backbone"),
});
The structure of the .json file seems to be in standard format.
[
{
name: 'Kobe Bryant',
team: 'Los Angeles Lakers',
team_id: 1,
number: 24
},
{
name: 'Lebron James',
team: 'Miami Heat',
team_id: 2,
number: 6
}
]
I simply copied and pasted the content into a blank file and saved it as players.json. However, I suspect there might be more to it than just that. I tried searching online but all I want is an easy way to store a dummy .json file on my localhost for easy access through a url in backbone.
In a previous tutorial I followed, they used this url as an example: