Detail:
https://github.com/hakimel/Ladda

使用

<link rel="stylesheet" href="/public/ladda/ladda.min.css">
<script src="/public/ladda/spin.min.js"></script>
<script src="/public/ladda/ladda.min.js"></script>

<button class="ladda-button" data-size="100" data-color="blue" data-style="expand-left" onclick="sub(this)">确认</button>


<script type="text/javascript">
function sub(obj){
var l = Ladda.create( document.querySelector( '.ladda-button' ) );
l.start();
$.ajax({url:"/xxxx/xxxx",data:{id:'${id}'},success:function(date){

$(obj).removeAttr("data-color");

l.stop();
}});
}
</script>