Hi

Just wondering if anyone could give me any pointers on what the best way to add loading feedback to a post function for my autocomplete would be. right now it can take some time to bring back results(slow server) so i just want to show some kind of loader graphic as user feedback some request is happening. What would be the best way to structure this in my current code?


code:

function lookup(inputString) {
if (inputString.length == 0) {
// Hide the suggestion box.
$('#suggestions').fadeOut('fast');
$('#hover-Box').fadeOut('fast');

} else {


$.post("Search.aspx", { Type: "" + typeofquery + "", Search: "" + inputString + "" }, function(data) {

setTimeout(function() {
if (data.length > 1) {

$('#suggestions').fadeIn('fast');
$('#autoSuggestionsList').html(data);

}

if ($('.autocomplete_element').length >= 1) {

//get the first element title and display in hover box

while (showitem == true) {
//show item if cond is true
var item = $('.titleid_search_hidden:first').text();
detail(item);
showitem = false; //subsequent req not allowed
}


} else {

if (data.length < 1) {
$('#suggestions').hide();
$('#hover-Box').hide();
}
}
}, 500); //end timeout 500ms
});
}
}