JSFiddle - React, Tailwind, and code Playground

by mohammadAdil

HTML

<input type='submit' id='sm'>
    <img id='yourLoadingImage' src='http://www.findstorageusa.com/images/small-loading.gif'/>

JavaScript

$('#yourLoadingImage').hide();
$('#sm').click(function(){
             $(this).attr('disabled','disabled');
             $(this).hide();
             $('#yourLoadingImage').show();


           $.ajax({
               url: "/echo/html/",
                }).done(function() {
                   $('#sm').attr('disabled',false);
                   $('#sm').show();
                   $('#yourLoadingImage').hide();
            });

       });