骨干模型,这里是我的登录模式保存响应值这使得保存()调用
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){
}
});
我张贴令牌服务器接收加密的用户名密码&。在成功的方法,它返回加密的凭据。
// 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){
}
);
如何设置响应(userName,passwd)到用户创建的loginmodel的属性?
难道你不会只使用'model.set'吗?还是你说你需要解密用户名和密码? – freejosh