From 123f0b66e79f442991ea1e665c08df6cd77afa5b Mon Sep 17 00:00:00 2001 From: xfra35 Date: Fri, 28 Aug 2015 16:45:45 +0200 Subject: [PATCH] Pass arguments to AJAX_SUCCESS and AJAX_FAIL --- README.md | 2 +- jquery.modal.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bd01c17..c58449e 100644 --- a/README.md +++ b/README.md @@ -225,7 +225,7 @@ The following events are triggered when AJAX modals are requested. $.modal.AJAX_FAIL = 'modal:ajax:fail'; $.modal.AJAX_COMPLETE = 'modal:ajax:complete'; -The handlers receive no arguments. The events are triggered on the `` element which initiated the AJAX modal. +The handlers receive the same arguments as the jQuery `jqXHR.done()` and `jqXHR.fail()` promise methods. The events are triggered on the `` element which initiated the AJAX modal. ## More advanced AJAX handling diff --git a/jquery.modal.js b/jquery.modal.js index 1c20e5a..ad97e55 100644 --- a/jquery.modal.js +++ b/jquery.modal.js @@ -28,13 +28,13 @@ el.trigger($.modal.AJAX_SEND); $.get(target).done(function(html) { if (!current) return; - el.trigger($.modal.AJAX_SUCCESS); + el.trigger($.modal.AJAX_SUCCESS,arguments); current.$elm.empty().append(html).on($.modal.CLOSE, remove); current.hideSpinner(); current.open(); el.trigger($.modal.AJAX_COMPLETE); }).fail(function() { - el.trigger($.modal.AJAX_FAIL); + el.trigger($.modal.AJAX_FAIL,arguments); current.hideSpinner(); el.trigger($.modal.AJAX_COMPLETE); });