[eluser]Nick Husher[/eluser]
Basically, the pseudocode for the Ajax-pinwheel loading icon is this:
1. MAKE AJAX REQUEST
1a. SET CALLBACK TO DELETE PINWHEEL
1b. INSERT CONTENT INTO DIV
1c. DO WHATEVER BUSINESS LOGIC IS NEEDED
2. DISPLAY PINWHEEL
Basically, because it's asnychronous you have to think about it a little backwards. Often times you'll define the thing you want done as the last step before you define any of the earlier steps.