ajax function become a standard alone function for reusability