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! While you're at it, check out some resources Treehouse students have shared here.

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

JavaScript Asynchronous Programming with JavaScript Asynchronous JavaScript with Callbacks Implement a Callback

Richard Preske
PLUS
Richard Preske
Courses Plus Student 4,356 Points

When debugging, this is error I get.

jquery.js:491 Uncaught TypeError: jQuery.each is not a function at jquery.js:491 at jquery.js:36 at jquery.js:40 (anonymous) @ jquery.js:491 (anonymous) @ jquery.js:36 (anonymous) @ jquery.js:40 ial.js:164 Uncaught ReferenceError: $ is not defined at ial.js:164 (anonymous) @ ial.js:164 csl.parser.js:2044 Uncaught ReferenceError: jQuery is not defined at csl.parser.js:2044 (anonymous) @ csl.parser.js:2044 extension.js:21 Uncaught TypeError: Cannot read property 'init' of undefined at Object.init (extension.js:21) at extension.js:45 at extension.js:48 init @ extension.js:21 (anonymous) @ extension.js:45 (anonymous) @ extension.js:48 callbacks.js:13 Uncaught TypeError: callback is not a function at XMLHttpRequest.xhr.onload

Not sure why it is saying callback is not a function. It seems there is something wrong with the requested data coming from Wikipedia or astroURL.

Steven Parker
Steven Parker
231,268 Points

Error messages are generally only useful when the code can be referenced, please also show the code.
Be sure to use Markdown formatting lor make a snapshot of your workspace and post the link to it here.

2 Answers

Steven Parker
Steven Parker
231,268 Points

The snapshot allowed me to replicate the issue and find it. :+1:

So on line 31 of "callbacks.js", there's an extra closing parenthesis, probably just a typo.

Richard Preske
Richard Preske
Courses Plus Student 4,356 Points

FIxed it, but still get error with only 2 astronauts. I get a 404 file not found error.

Steven Parker
Steven Parker
231,268 Points

That's not your program's fault. The API is listing a 3rd person as "Anatoly Ivanishin" (with a "y"), but the corresponding info page is under the name "Anatoli Ivanishin" (with an "i").

For a bonus exercise, you might try adding some code to make errors in looking up details a bit more graceful (like display the name and a "friendly" error message).