refactored ajax calls to go through ajax platform and made logout functionality