Sometimes, we want to display loading image or animation or text when fire every ajax request. In not for only one ajax request, but if you want to load image on every ajax request then you can do that using bellow example.
I use ajaxStart() and ajaxComplete() function for show image until All POST or GET Ajax request. this both function will execute one each $.ajax request.
<pre class="prettyprint lang-js">
If you are very fresher in jquery and you don't know how to work post ajax request then bellow example can help you. i gave you the example of POST ajax request with json, you can also easily modify this example. you also fire GET ajax request using this example. bellow example is a pretty simple to undestand how to work $.ajax method. so let's see bellow example and try to undestand.
<pre class="prettyprint lang-php">
<title>JQuery Ajax Demo</title>