mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-08 03:00:26 -04:00
adding a bit more explanation to Model#save onError
This commit is contained in:
14
index.html
14
index.html
@@ -708,10 +708,7 @@ setInterval(function() {
|
||||
method, and validation fails, the model will not be saved. If the model
|
||||
<a href="#Model-isNew">isNew</a>, the save will be a <tt>"create"</tt>
|
||||
(HTTP <tt>POST</tt>), if the model already
|
||||
exists on the server, the save will be an <tt>"update"</tt> (HTTP <tt>PUT</tt>). Accepts
|
||||
<tt>success</tt> and <tt>error</tt> callbacks in the options hash, which
|
||||
are passed <tt>(model, response)</tt> as arguments. The <tt>error</tt> callback will
|
||||
also be invoked if the model has a <tt>validate</tt> method, and validation fails.
|
||||
exists on the server, the save will be an <tt>"update"</tt> (HTTP <tt>PUT</tt>).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -732,6 +729,15 @@ var book = new Backbone.Model({
|
||||
book.save();
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<b>save</b> accepts <tt>success</tt> and <tt>error</tt> callbacks in the
|
||||
options hash, which are passed <tt>(model, response)</tt> as arguments.
|
||||
The <tt>error</tt> callback will also be invoked if the model has a
|
||||
<tt>validate</tt> method, and validation fails. If a server-side
|
||||
validation fails, return a non-<tt>200</tt> HTTP response code, along with
|
||||
an error response in text or JSON.
|
||||
</p>
|
||||
|
||||
<p id="Model-destroy">
|
||||
<b class="header">destroy</b><code>model.destroy([options])</code>
|
||||
<br />
|
||||
|
||||
Reference in New Issue
Block a user