I have a question regarding the fetch function of Backbone. I've read from the Backbone documentation that i开发者_开发问答t "Refreshes the model's state from the server." but on the server I don't have the same model, moreover how do I give the url connection with the server? Is it like:
var model = new Backbone.Model({
some: "data",
});
model.url = "www.some.url";
setInterval(function(){
model.fetch();
}, 10000);
And this would fetch from some.url every 10 seconds some JSON I guess, right? Where exactly do I receive & process this JSON?
Thanks a lot
Masiar
I found out by myself a simple solution:
setInterval(function(){
model.fetch({
success: function(){
//do something
}
});
}, 10000);
Hope this is going to be helpful for someone else!
Cheers, Masiar
精彩评论