javascript - Gif loader does not hides out after subscribing -


i trying integrate sendgrid subscription widget site (https://github.com/sendgrid/sendgrid-subscription-widget). sample code provided company partially working. hit sign button loader shows , displays success message, gif loader not hides out after receiving message. want loader stops showing process completes. have pasted js code snippet. cannot detect problem. might due marginal js knowledge.

    $(".sendgrid-subscription-widget").on("sent", function () {     $(this).addclass("loading")            .append("<img src=\"http://i.imgur.com/6rmhx.gif\" alt=\"loading...\">");     $(this).find("input[type=submit").attr("disabled", "disabled");      $(".sendgrid-subscription-widget").on("success error", function () {         $(this).removeclass("loading")         $(this).find("img").remove();         $(this).find("input[type=submit").removeattr("disabled");     }); });  

html markup

<div class="sendgrid-subscription-widget" data-token="1m5z249egjzj34d5lln3s2kkznimau9gzp8imujsw1pmhsjvugayewjxhtk1awlo" data-executed="true">     <form>         <div class="response"></div>         <label>             <span>email</span>             <input type="email" name="email" placeholder="you@example.com" />         </label>         <input type="submit" value="submit" />     </form>  <img src="http://i.imgur.com/6rmhx.gif" alt="loading..."> </div> 

change js :

$(".sendgrid-subscription-widget").on("sent", function () {     $(this).addclass("loading")            .append("<img src=\"http://i.imgur.com/6rmhx.gif\" alt=\"loading...\">");     $(this).find("input[type=submit").attr("disabled", "disabled");      $(".sendgrid-subscription-widget").on("success error", function () {         $(this).removeclass("loading")         $(document).find(".loading img").remove();         $(this).find("input[type=submit").removeattr("disabled");     }); }); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -