0
如何在Backbone js中創建註冊表單?併發送POST到我的後端,我不明白這種情況下收集的想法。主幹需要js註冊
我得到了什麼至今:
define(['jQuery', 'Underscore', 'Backbone', 'text!templates/signup.html', 'models/UserRegistration'],
function($, _, Backbone, signUpTemplate, UserRegistration){
var SignUpView = Backbone.View.extend({
el: $('#screen'),
events: {
'submit #frm-signup': 'signup'
},
signup: function(){
// Do something
},
render: function(){
$(this.el).html(_.template(signUpTemplate, {}));
return this;
}
});
return new SignUpView;
});
和模型:
define(['Underscore', 'Backbone'],
function(_, Backbone){
var UserRegistration = Backbone.Model.extend({
url: '/users/reg',
paramRoot: 'user',
defaults: {
'fullname': '',
'email': '',
'password': ''
}
});
return UserRegistration;
});
會是什麼,下一步,使其後到我的REST後端服務器?