here is my login model
LoginModel = Backbone.Model.extend({
initialize: function(){
},
defaults:{
userName: 'undefined',
passwd: 'undefined'
},
urlRoot: 'https://www.xxxx.xxxx/encryptedcredentials',
parse: function(response, options){
},
validate: function(attributes, options){
}
});
i am posting a token to the server to receive the encrypted username & password. on success method, it returns the encrypted credentials.
// creating a loginmodel
var loginmodel = new LoginModel();
// calling save to post the token
loginmodel.save({token:"xxxxxxxxxxxxxx"},{
success: function(model, response){
//server is returning encrypted the user name and password
response.encUserName;
response.encPassword
},
error: function(model, response){
}
);
how to set the response(userName, passwd) to the user created loginmodel's attributes?