Adding in proper error handling for the main ajax call