Skip to content

Commit

Permalink
Fixed re-enabling elements when ajax:beforeSend returns false.
Browse files Browse the repository at this point in the history
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
JangoSteve committed Aug 16, 2012
1 parent 3d5c7ce commit 12da9fc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rails.js
Expand Up @@ -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')) {
Expand Down

0 comments on commit 12da9fc

Please sign in to comment.