Added generic implementation for handling Ajax calls