query handling via ajax with loading indicator