Its simple all you have to do is just put an image and make it hide on page load like this..
<img id="loaderimg" src="/filepath/img.jpg" style="display:none;"></img>
And when your ajax starts to call you have to just show it
<script>
function a(){
$("#loaderimg").show()
$("#loaderimg").hide()
}
</script>