How should server respond to backbone sync

Viewed 1979

Some newbie questions about backbone.js' save and sync.

  1. After calling save/sync functions, what type of response does backbone expect from the server? Is any specific post-processing required after the response is received?

  2. How does backbone know whether the model already exists on the server? From the documentation I see that each model has an isNew that checks for whether there is an "id". So "id" is the id from the server, whereas "cid" is what backbone creates for each model. Correct? If so, what are the general steps for the server to inform backbone what the id of a model is, when:

    a) the model is first created and synced,

    b) subsequently when the model is fetched,

    c) or when the model is populated on page load?

Thanks for help.

1 Answers
Related