How can I write ajax calls using backbone.js, I read that sync is the key to ajax calls in backbone.js, but I am not able to understand it properly. It would be really helpful if it can be explained with an example.
Thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually I don’t usually call
syncby my own. We can say thesyncis the storage system connection,syncby default use an AJAX REST API to persists and load the objects.syncis the method you have to overwrite if you want to use another storage system.Instead of calling
syncdirectly you use methods likefetch,save,destroy, … wich ones will callsyncinternally.In the documentation there are several examples:
and more for Collection
The most simple example that comes to my mind can be how to load a Book Model from this url:
http://myapp.com/books/my_book.json