$.post jquery beforesend loader

JavaScript
$("#loading").ajaxStart(function(){
   $(this).show();
 });

$("#loading").ajaxComplete(function(){
   $(this).hide();
 });

Source

Also in JavaScript: