Skip to content

Commit

Permalink
Issue #20: Added AJAX_FAIL event.
Browse files Browse the repository at this point in the history
  • Loading branch information
kylefox committed Apr 20, 2012
1 parent 40bae80 commit 4c72b25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ The following events are triggered when AJAX modals are requested.

$.modal.AJAX_SEND = 'modal:ajax:send';
$.modal.AJAX_SUCCESS = 'modal:ajax:success';
$.modal.AJAX_FAIL = 'modal:ajax:fail';

The handlers receive no arguments. The events are triggered on the `<a>` element which initiated the AJAX modal.

Expand Down
6 changes: 5 additions & 1 deletion jquery.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
current.$elm.empty().append(html).on($.modal.CLOSE, remove);
current.hideSpinner();
current.open();
}).fail(function() { current.hideSpinner(); });
}).fail(function() {
el.trigger($.modal.AJAX_FAIL);
current.hideSpinner();
});
}
} else {
this.$elm = el;
Expand Down Expand Up @@ -160,6 +163,7 @@
$.modal.CLOSE = 'modal:close';
$.modal.AJAX_SEND = 'modal:ajax:send';
$.modal.AJAX_SUCCESS = 'modal:ajax:success';
$.modal.AJAX_FAIL = 'modal:ajax:fail';

$.fn.modal = function(options){
if (this.length === 1) {
Expand Down

0 comments on commit 4c72b25

Please sign in to comment.