js module to handle ajax calls