-
-
Save nquinlan/5f73a310830d56d0c532 to your computer and use it in GitHub Desktop.
[namespaced](http://api.jquery.com/on/#event-names) events for the sendgrid-subscription widget, to prevent a race condition.
This file contains 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
$(".sendgrid-subscription-widget").on("submit.loader", function () { | |
$(this).addClass("loading") | |
.append("<img src=\"my/super/cool/loading.gif\" alt=\"Loading...\">"); | |
$(this).find("input[type=submit").attr("disabled", "disabled"); | |
$(".sendgrid-subscription-widget").on("success.loader.response error.loader.response", function () { | |
$(this).removeClass("loading") | |
$(this).find("img").remove(); | |
$(this).find("input[type=submit").removeAttr("disabled"); | |
$(this).off(".loader.response"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment