Jump to content

backbone sync


jimfog

Recommended Posts

According to backbone manual the backbone.sync function is used to make requests to the server(to save a model in the database for example).

 

If the request is successful a "sync" event is returned.And here is my problem.

 

What exactly is this sync event?

 

In my case the request is made successfully but nothing is returned from the server.This is the code from an app I am building where events are stored in the db.

     if (this.model.isNew()) {                                                                                this.collection.create(this.model, {success: this.close});
close: function() {
//code that closes a dialog box.
},

 

The success callback above is triggered when the request is successful.In my case it never "fires" cause there is not a sync event returned from the server despite the data are saved to the db.I do not what exactly is going on here.

 

If the success callback fired that would had as a result that the close function(shown below) will be called.

 

Obviously, I am seeking help from someone who is experienced with backbone.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...