cleanup ajax response code and always parse json if the Content-Type: application/json header is there