backbone.js save with coffeescript -


i have following method on backbone view defined in coffeescript:

  saveobservation: =>     self = @     observation = new observation(parentuid: _questionuid, status: "n/a", text: "change element")     observation.save {           success: ->             alert('test')           error: ->             alert('failed')         } 

observation extended backbone.model

class observation extends backbone.model   url: ->     "/auditactiontracking/"   

the save reaches server neither success nor error handlers have defined in save getting called after ajax call has completed.

can see doing wrong?

backbone.model.save takes 2 parameters, first list of properties you're changing, , second callback configuration.

so, if you're not changing other properties during save, can pass empty object:

observation.save {},     success: (model, response) ->       alert('test')     error: (model, response) ->       alert('failed') 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -