Answer the question
In order to leave comments, you need to log in
How to properly organize ajax in backbonejs?
How to organize it correctly? Now I'm making requests via jQuery ajax, after that I'm doing collection.reser(data) and listening to the onReset event on the view to update it. How to do this via fetch() (I don't know if this is correct)?
I need to achieve the following:
1. I make a request to the server (send the selection criteria)
2. I get a response
3. I update the View.
Can you give an example of such functionality?
Answer the question
In order to leave comments, you need to log in
Correctly just through fetch. The principle is this:
view.listenTo(collection, 'sync', view.render); // встроенное событие, см. http://backbonejs.org/#Events-catalog
collection.fetch({reset: true}); // http://backbonejs.org/#Collection-fetch
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question