I am having problems figuring out the model.save syntax in Backbone + Coffeescript. (Rails 3)
I have the following:
@options.product_search.save({'url' : $("#product_search").val()},
{success: (event) => alert "StackOverflow"},
{error: (response) => alert "oh no!"}
)
- The success-event works in this case, the error-event doesn’t.
- I also can’t figure out how to add multiple actions to a success-event as coffeescript gives me a syntax-error when I split the code into multiple lines inside the success event.
Thank you for your help!
Best, Phil
You’re putting in a third parameter into the save method, where it only takes two:
This is just a coffeescript/javascript syntax error that’s easy to fix.
Try this: