Skip to content

Commit

Permalink
Before and after ajax request events
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jan 29, 2010
1 parent 9e7a550 commit d28da2c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rails.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ document.observe("dom:loaded", function() {
var url = element.readAttribute('data-url') || element.readAttribute('href');
var method = element.readAttribute('data-method') || 'GET';

element.fire("ajax:before");

new Ajax.Request(url, {
method: method,
asynchronous: true,
Expand All @@ -42,6 +44,8 @@ document.observe("dom:loaded", function() {
onSuccess: Callbacks.onSuccess.curry(element),
onFailure: Callbacks.onFailure.curry(element)
});

element.fire("ajax:after");
}

$(document.body).observe("click", function(event) {
Expand Down

0 comments on commit d28da2c

Please sign in to comment.