Want to display a waiting screen while query get executed

Want to display a waiting screen while query get executed

While the query fetches some information from the database i want to display a waiting screen like" Loading please wait" PLease help me this.
I find it for loading a page

the code is as

<html>
<head>
<title>Base page for content</title>
<script src="jquery.js" type="text/javascript"></script>
</head>
<body>
<div id="contentLoading" class="contentLoading">
<img src="VideoLoading.gif" alt="Loading data, please wait...">
</div>
<div id="contentArea">
</div>


<script type="text/javascript">

jQuery(function($) {
$("#contentArea").load("air.php");
});

$().ajaxSend(function(r,s){
$("#contentLoading").show();
});

$().ajaxStop(function(r,s){
$("#contentLoading").fadeOut("fast");
});

</script>
</body>
</html>

Now i want to have it for database loading..please hlp me