Fixed POST method and refactored how the AJAX requests used promises