Last Updated: February 25, 2016
·
1.427K
· Kresimir Pendic

Using jquery global ajax for spinner and stuff

When using ajax calls to somewhere, and you have to add spinner to make it all better for ux,, you can use global calls for that,

    /* make toggle nav on left */
$('.list-group a').click(function(){ 
    $(this).siblings().removeClass('active');
    $(this).addClass('active');
});
/* show spinner */
$( document ).ajaxStart(function() {
    $('#spinner').removeClass('hidden');
});
/* hide spinner */
$( document ).ajaxStop(function() {
    $('#spinner').addClass('hidden');
});

take a look here..

Picture

thsit, cheers :)

for demo I was using bootstrap from twitter