while ajax complete code example
Example: ajax call do something while
$('#loading').show() //show spinner
$.ajax({
url: '/path/to/file',
type: 'GET',
data: {param1: 'value1'},
})
.done(function() {
console.log("success");
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
$('#loading').hide();//hide your spinner here!!
});