0
我正在使用骨幹對我的API進行簡單的POST。但是,我需要在json文章中添加額外的細節以保存我的用戶。什麼是最好的方式和方式?在backbone.js上發佈更多JSON保存
用戶:{PK:1,名稱:測試}
var ParticipantView = Backbone.View.extend({
el: '#participant-panel',
events: {
'submit #participant-form': 'saveParticipant'
},// end of events
saveParticipant: function (ev) {
var participantDetails = $(ev.currentTarget).serializeObject();
var participant = new Participant();
participant.save(participantDetails, {
success: function (participant) {
alert("created")
},
error: function (model, response) {
console.log('error', model, response);
}
});// end of participant save function
return false; // make sure form does not submit
}// end of save participants
});// end of participant view