How to display an animated icon during Ajax request processing

This example uses the jQuery JavaScript library. First, create an Ajax icon using the [AjaxLoad site](http://www.ajaxload.info/). Then add the following to your HTML: ```javascript ``` And the following to your CSS file: ```javascript #loading-indicator { position: absolute; left: 10px; top: 10px; } ``` Lastly, you need to hook into the [Ajax events](http://docs.jquery.com/Ajax_Events) that jQuery provides; one event handler for when the Ajax request begins, and one for when it ends: ```javascript $(document).ajaxSend(function(event, request, settings) { $('#loading-indicator').show(); }); $(document).ajaxComplete(function(event, request, settings) { $('#loading-indicator').hide(); }); ```