// User
App.Models.User = Backbone.Model.extend({
urlRoot: 'https://jsonplaceholder.typicode.com/users/',
checkAuth: function () {
var options = {
success: function (mod, res) {
console.log('Успешно');
console.log(res.name);
},
error: function (mod, res) {
console.log('Не успешно');
}
}
this.fetch(options);
}
});
var userID = 1;
var user = new App.Models.User({
id: userID
});
user.checkAuth();
num.destroy({
success: function(model, response) {...},
error: function(err) {...}
});