You can do this with the global ajaxStart and ajaxComplete .
ajaxStart : http://api.jquery.com/ajaxStart/
ajaxComplete : http://api.jquery.com/ajaxComplete/
If you want to implement some specific loading indicators (for example, inside the input text), you need to associate some methods with jQuery and listen to the remote confirmation. Then, when it fires, you can start the indicator launch method, and when it is done, you can return it.
source share