var Subscribe_Page = function(){ } Subscribe_Page.prototype.register = function(){ $("#newsletter_form").submit(); } var View = null; $(document).ready(function(){ View = new Subscribe_Page(); $('.alert .close').click(function(){ $(this).parent().addClass('hidden'); }); $("#newsletter_form").ajaxForm({ beforeSubmit : function(){ $(".js-form-actions").hide(); $(".js-loading").show(); }, success : function(response){ res = eval(response); $(".js-loading").hide(); $(".js-recipient-alert .js-message").html(''); for (var i=0;i"); } if (res.error == 0){ $(".js-recipient-alert").removeClass("alert-danger").addClass("alert-info"); $("#newsletter_form .form-group").hide(); }else{ $(".js-recipient-alert").removeClass("alert-info").addClass("alert-danger"); $(".js-form-actions").show(); } $(".js-recipient-alert").removeClass("hidden"); } }); });