var LoginView = FormView.extend({ el: "#login", action: "/api/login", method: "POST", initialize: function(opt){ this.__super__.initialize.call(this) this.$("[name=username]").focus() }, showErrors: function(errors){ console.log(errors) }, success: function(data){ if (data.returnTo) { window.location.href = "/index" } else { window.location.href = "/index" } }, })