Skip to content
Create a gist now

Instantly share code, notes, and snippets.

var Fishe = {};
Fishe.Deck = Backbone.Model.extend({
initialize: function () {
alert("Welcome to this world");
}
});
Fishe.DeckCollection = Backbone.Collection.extend({
model: Fishe.Deck,
url: 'http://fishes.localhost/deck.json',
sync: function (method, model, options) {
console.log('syncing');
var params = _.extend({
type: 'GET',
dataType: 'jsonp',
url: this.url,
success: function (data, textStatus, jqXHR) {
console.log(data)
},
error: function (jqXHR, textStatus, errorThrown) {
this.model.set($.parseJSON(jqXHR.responseText));
}
}, options);
return $.ajax(params).done(function () {
console.log('finished')
});
}
});
DeckView = Backbone.View.extend({});
Fishe.data = {};
Fishe.data.decks = new Fishe.DeckCollection();
Fishe.data.eventView = new DeckView({
el: $('#decks')
,collection: Fishe.data.decks
}) ;
Fishe.data.decks.fetch({
success: function () {
console.log(this.collection.toJSON());
},
error: function () {
console.log('Failed to fetch!');
}
});
@eknbrk
eknbrk commented Mar 13, 2014

Were u able to overcome this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.