0
문제가 있습니다 - 양식의 데이터를 데이터베이스에 넣어야합니다 ... 백본 사용법이 있습니다! 어떻게 그럴 수 있습니까? 내 scrips 및 HTML 작성해야합니까? 내 모음입니다 :백본의 입력 필드에서 데이터를 저장하는 방법은 무엇입니까?
store: function(e)
{
e.preventDefault();
//select each input, select and textarea within this views $el
_.each(this.$('input, select, textarea'), function(input)
{
//you input name attribute to set the correct model attribute.
this.model.set(input.name, input.value);
}, this);
//new model attributes from the form are now available and ready to be synced
//with the server.
console.log(this.model.toJSON());
}
확인이 JsFiddle Demo :
define([
"underscore",
"backbone",
"jquery"
],
function(_, Backbone, $) {
return Backbone.Collection.extend({
url: '/users/all' //route for get ALL users in DB
});
});