我正在开发RESTful应用程序 - 我在服务器端使用Java,在前端使用Backbone.2将通过JSON进行通信.
我的应用程序有很多表单,我想:
我的问题:
我的代码到目前为止:
Javascript和Backbone
$(function(){
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
//Model
var SignupForm = Backbone.Model.extend();
//View
var SignupView = Backbone.View.extend({
el: '.signupForm',
events: {
'click input.submit': 'getStatus'
},
getStatus: function(event){
var data = …Run Code Online (Sandbox Code Playgroud)