0
votes

http://documentcloud.github.com/backbone/#Collection-fetch

According to the doc, "fetch" hits a url and GETS data.

How about POST? What if I want to CREATE or UPDATE something? What do I do ?

1
The opposite is of collections.fetch() is ()ɥɔʇǝɟ˙suoıʇɔǝןןoɔ.Derek 朕會功夫

1 Answers

0
votes

The "opposite" is save.

model.save([attributes], [options])

Save a model to your database (or alternative persistence layer), by delegating to Backbone.sync. The attributes hash (as in set) should contain the attributes you'd like to change -- keys that aren't mentioned won't be altered. If the model has a validate method, and validation fails, the model will not be saved. If the model isNew, the save will be a "create" (HTTP POST), if the model already exists on the server, the save will be an "update" (HTTP PUT).