return this.each(function () {
var obj = jQuery(this);
obj.submit(function () {
- jQuery('input[type=submit]', this).attr('disabled', 'disabled');
+ jQuery('input[type=submit], button', this).attr('disabled', 'disabled');
jQuery.ajax(jQuery.extend({
type: 'POST',
url: obj.attr('action'),
// Hide all loading images
jQuery('.loading-image').addClass('hidden');
// Re activate submit button
- jQuery('input[type=submit]', obj).removeAttr('disabled');
+ jQuery('input[type=submit], button', obj).removeAttr('disabled');
errorElt.show();
errorElt.html(jQuery('<div/>').html(xhr.responseText).text());
} else {
if (!returnToAnchor.val()) {
returnToAnchor.val(window.location.hash);
}
- })(window.jQuery);
- $j("#login_form").modalForm({
- success: function () {
- window.location = '<%= ApplicationController.root_context + h(@return_to) -%>' + $j('[name="return_to_anchor"]').val();
- },
- error: function () {
- jQuery('.alert').removeClass('hidden');
- }
- });
+ $("#login_form").modalForm({
+ success: function () {
+ window.location = '<%= h(@return_to) -%>' + $('[name="return_to_anchor"]').val();
+ },
+ error: function () {
+ $('.alert').removeClass('hidden');
+ $('button').prop('disabled', false);
+ },
+ statusCode: {
+ 401: null
+ }
+ });
+ })(window.jQuery);
</script>