Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggering of success and error events #24

Closed
stevenmhunt opened this issue Jan 18, 2013 · 1 comment
Closed

Triggering of success and error events #24

stevenmhunt opened this issue Jan 18, 2013 · 1 comment

Comments

@stevenmhunt
Copy link

This is a suggestion/enhancement that didn't warrant a fork and merge and doesn't fix a bug or error. At the end of the processData and processError functions, you trigger events that can be used to notify the application when data is processed or and error occurs. My suggestion is to modify the code to trigger the event on the element itself instead of document. The code currently looks like this:

$(document).trigger('bootstrap-ajax:success', [data, $el]);

I would recommend that it look like this:

$($el).trigger('bootstrap-ajax:success', [data]);

That way when I bind to it I can get events on my specific form or anchor that's posting back like this:

$("#myform").on("bootstrap-ajax:success", function(e, data) {
   ....
});

The current approach is functional, but I believe that the approach I am presenting is more in the spirit of jQuery and bootstrap.

Thank you for your consideration.

@paltman
Copy link
Contributor

paltman commented Jan 18, 2013

@stevenmhunt good tip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants