I\'m trying to fetch a collection from a JSON url. The backbone does send the request and does get a response but there are no models
in the collection after it
fetch
is asynchronous. Try
stores.fetch({
success:function() {
console.log(stores.toJSON());
}
});
or
stores.on("sync", function() {
console.log(stores.toJSON());
});
stores.fetch();
or
stores.fetch().then(function() {
console.log(stores.toJSON());
});
Get rid of the initialize function in your Item class. You don't need it.
There's no such thing as stores.models
-- if you want to see what's in it, you have to do console.log(stores.toJSON());