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]( 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]( 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(); }); ```