Created
January 30, 2010 01:07
-
-
Save simensen/290310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery('.emailLink').click(function(e) { | |
e.preventDefault(); | |
var $link = jQuery(this); | |
var $sending = jQuery('<span>Sending...</span>'); | |
$link.after($sending); | |
$link.hide(); | |
var restoreCb = function() { | |
$link.show(); | |
$sending.remove(); | |
}; | |
jQuery.ajax({ | |
url: $link.attr('href'), | |
error: function(xhr, textStatus, errorThrown) { | |
// handle error | |
restoreCb(); | |
}, | |
success: function(data) { | |
// Do something with the data that is returned. | |
// Only success in as much as the HTTP request | |
// was a success! | |
restoreCb(); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment