Skip to content
Browse files

Fixed re-enabling elements when ajax:beforeSend returns false.

This worked in jQuery 1.6 and 1.7 due to what was considered a bug,
according to this ticket, which has been fixed in jQuery 1.8:

http://bugs.jquery.com/ticket/10944
  • Loading branch information...
1 parent 3d5c7ce commit 12da9fc2f175c8e445413b15cf6b685deb271d6e @JangoSteve committed Aug 16, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/rails.js
View
8 src/rails.js
@@ -328,7 +328,13 @@
if (link.data('remote') !== undefined) {
if ( (e.metaKey || e.ctrlKey) && (!method || method === 'GET') && !data ) { return true; }
- if (rails.handleRemote(link) === false) { rails.enableElement(link); }
+ var handleRemote = rails.handleRemote(link);
+ // response from rails.handleRemote() will either be false or a deferred object promise.
+ if (handleRemote === false) {
+ rails.enableElement(link);
+ } else {
+ handleRemote.error( function() { rails.enableElement(link); } );
+ }
return false;
} else if (link.data('method')) {

0 comments on commit 12da9fc

Please sign in to comment.
Something went wrong with that request. Please try again.