Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Martin Coutts
Martin Coutts
18,154 Points

Issue displaying AJAX errors to users

I am working on a project to better understand API calls using AJAX. I am trying to display custom messages to the user based on the error if there is no information returned from the API however if I get an error and display it but then pick a competition where there shouldn't be an error then it still won't display the information.

What is the best way to deal with AJAX errors as I know there a few options available.

Here is a link to the repo, I am fully aware the code is a mess, goal is to get it working and then refactor it but it is very hacky at the moment.


Thank you for your help.