Moved api calls to ajax requests